html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    color-scheme: dark;
}

body {
    overflow-x: hidden;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(199, 154, 85, .5) rgba(255, 255, 255, .04);
}

::selection {
    color: #17100d;
    background: #efc477;
}

:focus-visible {
    outline: 2px solid #efc477;
    outline-offset: 3px;
}

img,
video,
canvas {
    max-width: 100%;
}

button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}

.device-mobile body {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.device-mobile button,
.device-mobile .btn,
.device-mobile nav a,
.device-mobile input,
.device-mobile select {
    min-height: 44px;
}

.device-mobile input,
.device-mobile select,
.device-mobile textarea {
    font-size: 16px;
}

/* iOS may apply dark-scheme white text to controls even when a page uses a light field. */
.device-mobile input,
.device-mobile textarea {
    caret-color: currentColor;
}

.device-mobile .modal,
.device-mobile .modal-overlay,
.device-mobile .modal-backdrop {
    padding: 12px;
}

.device-mobile .modal-box,
.device-mobile .modal-content {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
}

.device-mobile .modal {
    width: auto;
    max-width: none;
    max-height: none;
    overflow: visible;
}

.device-mobile .topbar,
.device-mobile .site-header,
.device-mobile .header {
    max-width: 100%;
}

.device-mobile .nav,
.device-mobile .nav-links,
.device-mobile .actions,
.device-mobile .account-actions,
.device-mobile .filters,
.device-mobile .tabs {
    row-gap: 8px;
}

.device-mobile .item-tooltip {
    width: min(260px, calc(100vw - 32px));
}

.device-mobile .market-list,
.device-mobile .chat-messages,
.device-mobile .code-list {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.device-mobile .panel,
.device-mobile .profile-card,
.device-mobile .edit-section,
.device-mobile .market-item,
.device-mobile .item-card {
    min-width: 0;
}

.device-desktop .topbar,
.device-desktop .site-header {
    backface-visibility: hidden;
}

/* Desktop navigation system: one title row followed by one orderly tab rail. */
.device-desktop .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 18px !important;
}

.device-desktop .topbar > .brand,
.device-desktop .topbar > :first-child:not(.nav) {
    min-width: 0;
}

.device-desktop .topbar > .nav {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr)) !important;
    gap: 7px !important;
    align-items: stretch !important;
    justify-content: stretch !important;
}

.device-desktop .topbar > .nav > .btn,
.device-desktop .topbar > .nav > a,
.device-desktop .topbar > .nav > button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 12px !important;
    text-align: center !important;
    white-space: nowrap;
}

.device-desktop .site-header > .nav {
    width: min(1440px, calc(100% - 36px)) !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 11px 0 12px !important;
}

.device-desktop .site-header .nav-links {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    gap: 6px !important;
    align-items: stretch !important;
}

.device-desktop .site-header .nav-links > a,
.device-desktop .site-header .nav-links > button {
    width: 100%;
    min-width: 0;
    min-height: 42px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px !important;
    text-align: center;
    white-space: nowrap;
}

.device-desktop .container > .header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap;
}

.device-desktop .container > .header > .hero-copy,
.device-desktop .container > .header > .title {
    flex: 1 1 300px;
    min-width: 220px;
}

.device-desktop .container > .header > button,
.device-desktop .container > .header > a {
    min-width: 104px;
    min-height: 44px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 14px !important;
    text-align: center;
    white-space: nowrap;
}

.device-desktop .section-tabs,
.device-desktop .tabs {
    align-items: stretch;
}

.device-desktop .section-tabs > button,
.device-desktop .tabs > button {
    height: 100%;
}

.topbar > .nav > .is-current,
.site-header .nav-links > .is-current,
.container > .header > .is-current {
    border-color: rgba(239, 196, 119, .58) !important;
    background: linear-gradient(135deg, rgba(143, 39, 48, .38), rgba(199, 154, 85, .14)) !important;
    color: #fff4df !important;
    box-shadow: inset 0 -2px 0 rgba(239, 196, 119, .82);
}

.panel,
.card,
.item,
.topbar,
.header,
.site-header,
.modal,
.modal-box,
.modal-content {
    isolation: isolate;
}

.panel,
.card,
.item {
    border-radius: 6px !important;
}

.btn,
button,
input,
select,
textarea {
    transition-duration: .2s;
}

.journey-page-switcher {
    --switcher-ink: #fff5e4;
    --switcher-muted: rgba(255, 245, 228, .58);
    --switcher-line: rgba(239, 196, 119, .2);
    position: fixed;
    z-index: 100000;
    inset: 0;
    pointer-events: none;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.journey-switcher-trigger {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    right: 14px;
    min-width: 78px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 13px;
    border: 1px solid rgba(239, 196, 119, .38);
    border-radius: 7px;
    color: var(--switcher-ink);
    background: rgba(18, 12, 10, .9);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .32);
    backdrop-filter: blur(14px);
    pointer-events: auto;
    cursor: pointer;
    font-weight: 800;
}

.journey-switcher-trigger.has-unread {
    border-color: rgba(236, 105, 86, .75);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .32), 0 0 0 3px rgba(236, 105, 86, .12);
}

.journey-global-message-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    border: 2px solid #17100e;
    border-radius: 999px;
    color: #fff;
    background: #d54d3f;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .35);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.journey-global-message-badge[hidden] { display: none !important; }

.journey-switcher-trigger:hover {
    border-color: rgba(239, 196, 119, .72);
    background: #2a1714;
}

.journey-switcher-lines,
.journey-switcher-lines::before,
.journey-switcher-lines::after {
    width: 16px;
    height: 2px;
    display: block;
    border-radius: 2px;
    background: #efc477;
}

.journey-switcher-lines { position: relative; }
.journey-switcher-lines::before,
.journey-switcher-lines::after { content: ""; position: absolute; left: 0; }
.journey-switcher-lines::before { top: -5px; }
.journey-switcher-lines::after { top: 5px; }

.journey-switcher-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    opacity: 0;
    background: rgba(5, 4, 4, .62);
    backdrop-filter: blur(5px);
    transition: opacity .22s ease;
}

.journey-switcher-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(430px, calc(100vw - 24px));
    height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
    border-left: 1px solid var(--switcher-line);
    color: var(--switcher-ink);
    background:
        radial-gradient(circle at 100% 0, rgba(143, 39, 48, .28), transparent 34%),
        linear-gradient(160deg, #17100e, #090707 72%);
    box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
    transform: translateX(104%);
    transition: transform .28s cubic-bezier(.22, .8, .25, 1);
    overflow-y: auto;
    pointer-events: auto;
}

.journey-page-switcher.is-open .journey-switcher-backdrop { opacity: 1; pointer-events: auto; }
.journey-page-switcher.is-open .journey-switcher-panel { transform: translateX(0); }
.journey-page-switcher.is-open .journey-switcher-trigger { opacity: 0; pointer-events: none; }
.journey-switcher-open { overflow: hidden; }

.journey-switcher-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--switcher-line);
}

.journey-switcher-head strong { display: block; font: 900 25px "STKaiti", "KaiTi", serif; }
.journey-switcher-head span { display: block; margin-top: 6px; color: var(--switcher-muted); font-size: 12px; }
.journey-switcher-close {
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--switcher-line);
    border-radius: 5px;
    color: var(--switcher-muted);
    background: transparent;
    cursor: pointer;
}

.journey-switcher-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.journey-switcher-grid a {
    position: relative;
    min-width: 0;
    min-height: 88px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 10px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 6px;
    color: var(--switcher-ink);
    background: rgba(255, 255, 255, .035);
    text-decoration: none;
}

.journey-message-entry .journey-global-message-badge {
    top: 8px;
    right: 8px;
    border-color: #1c1210;
}

.journey-switcher-grid a:hover,
.journey-switcher-grid a.is-current {
    border-color: rgba(239, 196, 119, .42);
    background: linear-gradient(135deg, rgba(143, 39, 48, .3), rgba(199, 154, 85, .1));
}

.journey-switcher-index {
    grid-row: 1 / 3;
    align-self: center;
    color: #c79a55;
    font: 700 11px Georgia, serif;
}
.journey-switcher-grid strong { align-self: end; font-size: 14px; }
.journey-switcher-grid small { align-self: start; margin-top: 4px; color: var(--switcher-muted); font-size: 10px; }

@media (max-width: 560px) {
    .journey-switcher-trigger { top: max(82px, calc(env(safe-area-inset-top) + 66px)); right: 8px; min-width: 66px; min-height: 38px; padding: 0 10px; font-size: 12px; }
    .journey-switcher-panel { width: 100vw; padding-left: 14px; padding-right: 14px; border-left: 0; }
    .journey-switcher-grid { gap: 6px; }
    .journey-switcher-grid a { min-height: 76px; padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .journey-switcher-backdrop,
    .journey-switcher-panel { transition: none; }
}

.btn,
nav a,
.nav a {
    border-radius: 5px !important;
}

input,
select,
textarea,
.modal,
.modal-box,
.modal-content,
dialog {
    border-radius: 6px !important;
}

.badge,
.tag,
.chip,
.reward-chip {
    border-radius: 4px !important;
}

main > section,
.page > section {
    content-visibility: auto;
    contain-intrinsic-size: auto 560px;
}

@media (hover: none) {
    .btn:hover,
    button:hover,
    a:hover,
    .item:hover,
    .card:hover {
        transform: none !important;
    }
}

@media (max-width: 420px) {
    .device-mobile .modal-actions,
    .device-mobile .actions,
    .device-mobile .account-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .device-mobile .modal-actions > *,
    .device-mobile .actions > *,
    .device-mobile .account-actions > * {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .device-mobile .container,
    .device-mobile .page,
    .device-mobile .app {
        width: 100%;
        max-width: 100%;
    }

    .device-mobile h1 {
        overflow-wrap: anywhere;
    }

    .device-mobile .topbar {
        gap: 12px;
    }

    .device-mobile .panel-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .device-mobile .market-tools {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .device-mobile .market-tools .btn {
        width: 100%;
    }

    .device-mobile .status {
        width: 100%;
        gap: 8px 14px;
    }

    .device-mobile body {
        background-attachment: scroll !important;
    }

    .device-mobile .site-header,
    .device-mobile .topbar,
    .device-mobile .header {
        backdrop-filter: none !important;
    }
}

@media (max-width: 390px) {
    .device-mobile .catalog-grid {
        grid-template-columns: 1fr;
    }

    .device-mobile .public-bag-grid,
    .device-mobile .bag-grid {
        gap: 4px;
    }

    .device-mobile .item-tooltip {
        width: calc(100vw - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
/* Cross-page navigation lives exclusively in the global Page switcher. */
html.journey-single-navigation .topbar > .nav,
html.journey-single-navigation .topbar > nav,
html.journey-single-navigation .site-header .nav-links,
html.journey-single-navigation header > nav:not(.rail-nav),
html.journey-single-navigation .top > .top-actions > .home-link,
html.journey-single-navigation .header > button[onclick*="location.href"],
html.journey-single-navigation .header > a[href$=".html"] {
    display: none !important;
}
