header {
    width: 100%;
    height: 120px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

header *:last-child {
    margin-right: var(--padding);
}
header *:first-child {
    margin-left: var(--padding);
}

header .header-space {
    flex: 1;
}

header .header-image {
    height: var(--client-header-desktop-logo-height, 50px);
    max-width: min(300px, 30vw);
    object-fit: contain;
}

header .header-balance {
    border: var(--foreground-color) solid 1px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 5px 25px;
}

header .header-balance p {
    font-size: 1rem;
    width: 100%;
    padding: 0;
    margin: 0;
}

header .header-balance b {
    font-size: 1.1rem;
    width: 100%;
    font-weight: 400;
    padding: 0;
    margin: 0;
}

header .header-balance span {
    font-size: .7rem;
    width: 100%;
    padding: 0;
    margin: 0;
}

header .header-nickname {
    margin: 0 50px;
}

header.header-info-hidden .header-balance,
header.header-info-hidden .header-nickname,
.phone-nav-account.header-info-hidden {
    display: none;
}

nav {
    width: 100%;
    height: 50px;
    background-color: var(--primary-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

nav *:last-child { margin-right: var(--padding); }

nav .nav-space { flex: 1; }

nav .nav-item {
    margin: 0 20px;
    text-decoration: none;
    color: var(--secondary-color);
    font-size: 1.1rem;
    position: relative;
}

nav .nav-item.active::after {
    display: block;
}

nav .nav-item::after {
    content: "";
    position: absolute;
    width: 100%;
    top: 100%;
    left: 0;
    height: 1.5px;
    background-color: var(--secondary);
    border-radius: 8px;
    display: none;
}

nav .nav-button {
    width: 150px;
    height: 20px;
}

nav .nav-button + .nav-button {
    margin-left: 10px;
}

nav .nav-button.active {
    outline: 2px solid var(--foreground2);
    outline-offset: -2px;
}

@media screen and (min-width: 1001px) and (max-width: 1300px) {
    nav .nav-item { margin: 0 5px; font-size: 1rem; }
    nav .nav-button { width: 100px; font-size: .9rem; white-space: nowrap; }
}

nav .nav-item:first-child { margin-left: var(--padding); }

.nav-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.phone-header {
    display: none;
    width: 100vw;
    height: 70px;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    background: var(--bg);
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.1);
}
.phone-header .header-image {
    height: var(--client-header-mobile-logo-height, 40%);
    max-width: 55vw;
    object-fit: contain;
    margin-left: 40px;
}
.phone-header .header-menu {
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    margin-right: 30px;
    padding: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.phone-header .header-menu img {
    display: block;
    width: 100%;
    height: 100%;
}
.phone-header .space {
    flex: 1;
}

.phone-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
}

.phone-nav {
    display: none;
    flex-direction: column;
    box-sizing: border-box;
    width: 75vw;
    background: var(--bg);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0, 0, 0, .14);
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .24s ease, visibility .24s;
}
.phone-nav-container {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.phone-nav-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.phone-nav-close {
    box-sizing: border-box;
    align-self: flex-end;
    width: 40px;
    height: 40px;
    padding: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.phone-nav-close img {
    display: block;
    width: 100%;
    height: 100%;
}

.phone-nav-account {
    min-width: 0;
    max-width: 100%;
    padding-top: 12px;
}

.phone-nav .nav-nickname {
    color: var(--fg);
    font-size: 1.2rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.phone-nav .nav-balance {
    margin-top: 5px;
    color: var(--fg);
    font-size: .85rem;
}

.phone-nav .nav-balance-amount.is-negative {
    color: #c62828;
}

.phone-nav .nav-divider {
    width: 100%;
    height: 1px;
    margin: 18px 0 12px;
    background: var(--secondary3);
}

.phone-nav-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.phone-nav .nav-item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    width: 100%;
    padding: 8px 6px;
    text-decoration: none;
    color: var(--fg);
    font-size: 1rem;
    border-radius: 8px;
}

.phone-nav .nav-item img {
    flex: none;
    width: 24px;
    height: 24px;
}

.phone-nav .nav-item-sub {
    padding-left: 22px;
    font-size: .94rem;
}

.phone-nav .nav-item:hover,
.phone-nav .nav-item:focus-visible,
.phone-nav .nav-item.active {
    background: color-mix(in srgb, var(--primary) 25%, var(--bg));
}

.phone-nav .nav-item.active {
    font-weight: 700;
}

.phone-nav .nav-exit {
    margin-top: auto;
    border-top: 1px solid var(--secondary3);
    border-radius: 0;
    padding-top: 16px;
}

body.phone-nav-open {
    overflow: hidden;
}

@media screen and (max-width: 1000px) {
    header {
        display: none;
    }
    nav {
        display: none;
    }
    .phone-header {
        display: flex;
    }
    .phone-nav,
    .phone-nav-backdrop {
        display: flex;
    }
    .phone-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }
    .phone-nav-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .phone-nav,
    .phone-nav-backdrop {
        transition: none;
    }
}
