/* Polish over the theme (28.10.2026): menus of the header, the account menu with the icons of the game, smooth answers
   to what the player does (hover, open, switch) and a soft change between pages. Loaded after the theme. */

/* ---------- The game icons ---------- */

/* Item pictures and HUD medallions of the client, as small icons next to a menu entry. */
.nav-menu img,
.account-menu img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex: none;
    filter: drop-shadow(0 2px 3px rgb(0 0 0 / .55));
}

/* ---------- Header menus ---------- */

.nav-group { position: relative; display: flex; }

/* the words and the arrow stay on one line in every language (06.11.2026: in Russian the arrow went under the word) */
.nav > a, .nav-group > a { white-space: nowrap; }

.nav-group > a {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-display);
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--text);
    padding: 7px 14px;
    border-radius: 999px;
    transition: color .15s, background .15s;
}
.nav-group > a::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 0 3px 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    opacity: .6;
    transition: transform .2s ease, opacity .2s;
}
.nav-group > a:hover, .nav-group:focus-within > a { color: var(--heading); background: rgb(255 255 255 / .06); }
.nav-group > a.is-active { color: var(--accent); background: var(--accent-soft); }
.nav-group:hover > a::after, .nav-group:focus-within > a::after { transform: translateY(2px) rotate(45deg); opacity: 1; }

.nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    min-width: 210px;
    padding: 6px;
    display: grid;
    gap: 2px;
    background: color-mix(in srgb, var(--bg-color) 96%, transparent);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgb(0 0 0 / .5);
    backdrop-filter: blur(14px) saturate(1.2);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -6px);
    transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
    z-index: 20;
}
/* a bridge over the gap, so the menu stays open on the way down */
.nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.nav-group:hover > .nav-menu,
.nav-group:focus-within > .nav-menu {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    transition: opacity .16s ease, transform .16s ease, visibility 0s;
}
.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: var(--radius-small);
    color: var(--text);
    font-size: .9rem;
    white-space: nowrap;
    transition: background .12s, color .12s;
}
.nav-menu a:hover, .nav-menu a:focus-visible { background: var(--accent-soft); color: var(--heading); }

/* "in 9 min" -> "in 10 min": the time of the next event keeps its width, so the menu beside it doesn't move */
.events-next { display: inline-block; min-width: 7.2em; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .events-next { display: none; } }

/* a laptop: the menu of the longer Russian words still fits in one line */
@media (min-width: 861px) and (max-width: 1240px) {
    .nav > a, .nav-group > a { padding: 7px 8px; font-size: .84rem; }
    .nav-group > a::after { margin-left: 5px; }
}
@media (min-width: 861px) and (max-width: 1040px) {
    .nav > a, .nav-group > a { padding: 6px 6px; font-size: .8rem; }
    .events-next { display: none; }
}
@media (min-width: 861px) and (max-width: 940px) {
    .events-label { display: none; }
}


@media (max-width: 860px) {
    /* the open menu covers the page: a solid panel, scrolled when it's taller than the screen */
    .nav {
        background: color-mix(in srgb, var(--bg-color) 97%, transparent);
        backdrop-filter: blur(14px);
        box-shadow: 0 18px 40px rgb(0 0 0 / .55);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    .nav-group { flex-direction: column; }
    .nav-group > a::after { display: none; }
    .nav-menu {
        position: static;
        min-width: 0;
        padding: 0 0 4px 14px;
        background: none;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .nav-menu::before { display: none; }
    .nav-group:hover > .nav-menu, .nav-group:focus-within > .nav-menu { transform: none; }
}

/* ---------- The account menu (sidebar) ---------- */

.account-menu {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 12px 0 10px;
}
.account-menu span { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-weight: 600; }
.account-menu small { color: var(--text-muted); font-size: .74rem; font-weight: 400; }
.account-menu a.is-active small { color: var(--text-muted); }
.account-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: rgb(255 255 255 / .02);
    color: var(--text);
    font-size: .84rem;
    line-height: 1.2;
    transition: border-color .15s, background .15s, color .15s;
}
.account-menu a:hover, .account-menu a:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--heading); }
.account-menu a.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.account-menu a img { transition: transform .2s ease; }
.account-menu a:hover img { transform: scale(1.12) rotate(-4deg); }
.account-logout { margin: 0; text-align: right; }
.account-logout button { padding: 2px 0; color: var(--text-muted); font-size: .82rem; letter-spacing: 0; text-transform: none; transition: color .15s; }
.account-logout button:hover { color: var(--accent); }

/* ---------- Answers to the player ---------- */

/* the spoilers of the wiki open smoothly (browsers without ::details-content just open them) */
.wiki-spoiler { interpolate-size: allow-keywords; transition: border-color .15s; }
.wiki-spoiler:hover { border-color: rgb(255 196 58 / .35); }
.wiki-spoiler::details-content {
    height: 0;
    overflow: hidden;
    transition: height .25s ease, content-visibility .25s allow-discrete;
}
.wiki-spoiler[open]::details-content { height: auto; }

/* the tabs of the wiki fade in */
.wiki-tab { animation: polish-fade .2s ease; }

/* the menu of the wiki marks where the reader is */
.wiki-list a { transition: color .15s, padding-left .15s; }
.wiki-list a:hover { padding-left: 4px; }

@keyframes polish-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Between pages ---------- */

/* a soft cross-fade from page to page (browsers with view transitions); the header stays in place */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root) { animation: polish-out .16s ease both; }
::view-transition-new(root) { animation: polish-in .22s ease both; }
@keyframes polish-out { to { opacity: 0; } }
@keyframes polish-in { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .wiki-tab { animation: none; }
    .wiki-spoiler::details-content { transition: none; }
    .nav-menu, .account-menu a img { transition: none; }
}

/* the tabs of the rankings on a phone (01.11.2026): they scroll by themselves instead of widening the page */
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.tabs a { flex: none; white-space: nowrap; }
.toolbar { min-width: 0; }
.toolbar > .tabs { min-width: 0; }

/* the phone (26.11.2026): compact and nothing scrolls to the side - tables wrap their text, the tabs wrap into rows,
   the podium of the rankings stands in one row with small models */
@media (max-width: 640px) {
    .panel { padding: 14px 12px; }
    .table-wrap { overflow-x: visible; }
    .table { width: 100%; font-size: .82rem; }
    .table th, .table td { padding: 6px 5px; white-space: normal; overflow-wrap: anywhere; }
    .table th { font-size: .66rem; letter-spacing: .02em; }
    .db-table .db-icon { width: 28px; height: 28px; }
    .wiki-body table { display: table; width: 100%; overflow: visible; font-size: .78rem; }
    .wiki-body th, .wiki-body td { padding: 4px 5px; white-space: normal; overflow-wrap: anywhere; }
    .wiki-body a.wiki-ref { white-space: normal; }
    .tabs { flex-wrap: wrap; overflow: visible; }
    .tabs a { flex: 1 1 auto; white-space: normal; text-align: center; padding: 8px 10px; font-size: .78rem; }
    .tabs a + a { border-left: 0; }
    .tabs a { border: 1px solid var(--line-strong); margin: -1px 0 0 -1px; }
    .podium { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
    .podium-place .charview, .podium-place.podium-1 .charview { height: 170px; }
    .podium-place.podium-1 { order: 0; }
    .podium-place figcaption { font-size: .72rem; }
    .progress-tabs { flex-wrap: wrap; }
    main img, main video { max-width: 100%; }
}
@media (max-width: 640px) {
    .sell-mode, .mf-seg { flex-wrap: wrap; }
    .sell-mode .mf-chip, .mf-seg .mf-chip { flex: 1 1 100%; }
    .sell-mode .mf-chip span, .mf-seg .mf-chip span { white-space: normal; }
}

/* 26.11.2026: the bar above the header on a phone - the server strip and the user panel in two rows (the flags ran into
   "Offline"); a combo price wraps with its button under it */
@media (max-width: 640px) {
    .statusbar-inner { flex-wrap: wrap; row-gap: 4px; padding: 4px 12px; }
    .statusbar-inner > .server-strip { flex: 1 1 auto; }
    .statusbar-inner > .user-panel { flex: 1 1 100%; justify-content: flex-end; margin-left: 0; }
}
.buy-option.is-combo { flex-wrap: wrap; }
.buy-option.is-combo .price-tag { flex: 1 1 100%; white-space: normal; overflow-wrap: anywhere; }
.buy-option.is-combo .price-tag { display: block; }
.buy-option.is-combo .price-tag strong { margin-right: 6px; overflow-wrap: normal; }
/* 26.11.2026: on a phone the numbers of a table stay whole (the level and the HP broke digit by digit), the bar above
   the header is solid (the sticky header showed the page through it), the online count stays on one line */
@media (max-width: 640px) {
    .table td.num, .table th.num { white-space: nowrap; overflow-wrap: normal; }
    .statusbar { background: var(--bg-color, #0d0b12); }
    .server-players { white-space: nowrap; }
}
