/* 基础布局：顶栏 + 内容区 + 移动端底部五导航（中央＋凸起） */

* { box-sizing: border-box; }

/* 关键：组件类设置 display 会覆盖 [hidden] 的 UA 样式，
   不加这句登录后"登录/注册"按钮不会消失（2026-09-25 线上踩坑）。 */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--hy-font);
    background-color: var(--hy-bg);
    background-image: var(--hy-bg-wash, none);
    background-attachment: fixed;
    color: var(--hy-text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--hy-accent);
    outline-offset: 2px;
}

/* ---------- 顶栏（桌面主导航 / 移动端精简） ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: var(--hy-z-topnav);
    background: color-mix(in srgb, var(--hy-bg-soft) 78%, transparent);
    backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid var(--hy-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 8px 28px -18px rgba(0, 0, 0, .55);
}

.topbar-inner {
    max-width: var(--hy-content-wide);
    margin: 0 auto;
    height: var(--hy-topbar-h);
    padding: 0 var(--hy-space-5);
    display: flex;
    align-items: center;
    gap: var(--hy-space-4);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--hy-space-2);
    font-weight: 700;
    font-size: 17px;
    white-space: nowrap;
}

.brand-logo { width: 26px; height: 26px; }

.brand-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--hy-accent-contrast);
    background: var(--hy-accent);
    border-radius: var(--hy-radius-pill);
    padding: 1px 8px;
}

.topnav {
    display: none;
    gap: var(--hy-space-1);
    flex: 1;
}

.topnav a {
    padding: 6px 14px;
    border-radius: var(--hy-radius-pill);
    color: var(--hy-text-muted);
    font-weight: 500;
    transition: color var(--hy-transition), background var(--hy-transition);
}

.topnav a:hover { color: var(--hy-text); background: var(--hy-surface-2); }
.topnav a.active { color: var(--hy-accent-contrast); background: var(--hy-accent); }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--hy-space-2);
    margin-left: auto;
}

.icon-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--hy-border);
    background: var(--hy-surface);
    color: var(--hy-text-muted);
    border-radius: var(--hy-radius-pill);
    transition: color var(--hy-transition), border-color var(--hy-transition);
}

.icon-btn:hover { color: var(--hy-text); border-color: var(--hy-accent); }

.user-chip {
    display: flex;
    align-items: center;
    gap: var(--hy-space-2);
    padding: 3px 12px 3px 4px;
    border: 1px solid var(--hy-border);
    background: var(--hy-surface);
    border-radius: var(--hy-radius-pill);
    max-width: 180px;
}

.user-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--hy-surface-2);
}

.user-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--hy-space-2);
    border: 1px solid var(--hy-border);
    background: var(--hy-surface);
    color: var(--hy-text);
    border-radius: var(--hy-radius-md);
    padding: 9px 18px;
    font-weight: 500;
    transition: background var(--hy-transition), border-color var(--hy-transition), opacity var(--hy-transition);
}

.btn:hover { background: var(--hy-surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: var(--hy-accent);
    border-color: var(--hy-accent);
    color: var(--hy-accent-contrast);
}

.btn-primary:hover { background: var(--hy-accent-strong); border-color: var(--hy-accent-strong); }

.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--hy-radius-sm); }
.btn-block { width: 100%; }

/* ---------- 内容区 ---------- */

.view {
    max-width: var(--hy-content-max);
    margin: 0 auto;
    padding: var(--hy-space-4) var(--hy-space-4) calc(var(--hy-bottomnav-h) + var(--hy-space-6) + env(safe-area-inset-bottom));
    min-height: calc(100dvh - var(--hy-topbar-h));
}

/* 宽屏视图（集市等）：铺满显示器，不让两侧留白 */
.view--wide {
    max-width: var(--hy-content-wide);
    padding-left: var(--hy-space-5);
    padding-right: var(--hy-space-5);
}

/* ---------- 底部导航（移动端，五项，中央＋凸起） ---------- */

.bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--hy-z-bottomnav);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--hy-bottomnav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--hy-bg-soft) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--hy-border);
}

.bottomnav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--hy-text-faint);
    font-size: 11px;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--hy-transition);
}

.bottomnav a.active { color: var(--hy-accent); }

.bottomnav .nav-icon { font-size: 20px; line-height: 1; }

.bottomnav a.nav-create {
    position: relative;
}

.bottomnav a.nav-create .nav-icon {
    width: 46px;
    height: 46px;
    margin-top: -22px;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--hy-accent-contrast);
    background: var(--hy-accent);
    border-radius: 50%;
    box-shadow: var(--hy-shadow-2);
    border: 3px solid var(--hy-bg-soft);
    transition: transform var(--hy-transition);
}

.bottomnav a.nav-create:active .nav-icon { transform: scale(.94); }
.bottomnav a.nav-create.active .nav-icon { background: var(--hy-accent-strong); }

/* ---------- 桌面自适应 ---------- */

@media (min-width: 768px) {
    .topnav { display: flex; }
    .bottomnav { display: none; }
    .view {
        padding-bottom: var(--hy-space-7);
    }
}

/* ---------- 通用小组件 ---------- */

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin: var(--hy-space-2) 0 var(--hy-space-4);
}

.muted { color: var(--hy-text-muted); }
.faint { color: var(--hy-text-faint); font-size: 13px; }

.empty-state {
    text-align: center;
    padding: var(--hy-space-7) var(--hy-space-4);
    color: var(--hy-text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: var(--hy-space-3); }

.loading {
    display: grid;
    place-items: center;
    padding: var(--hy-space-7);
    color: var(--hy-text-muted);
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--hy-border);
    border-top-color: var(--hy-accent);
    border-radius: 50%;
    animation: hy-spin .8s linear infinite;
    margin-bottom: var(--hy-space-3);
}

@keyframes hy-spin { to { transform: rotate(360deg); } }

/* ---------- 弹窗 ---------- */

.modal-scrim {
    position: fixed;
    inset: 0;
    z-index: var(--hy-z-modal);
    background: var(--hy-scrim);
    display: grid;
    place-items: center;
    padding: var(--hy-space-4);
    animation: hy-fade var(--hy-transition);
}

.modal {
    width: min(420px, 100%);
    max-height: min(86dvh, 720px);
    overflow: auto;
    background: var(--hy-bg-soft);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    box-shadow: var(--hy-shadow-2);
    padding: var(--hy-space-5);
    animation: hy-pop var(--hy-transition);
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 var(--hy-space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    border: none;
    background: none;
    color: var(--hy-text-faint);
    font-size: 20px;
    line-height: 1;
    padding: 4px;
}

@keyframes hy-fade { from { opacity: 0; } }
@keyframes hy-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- 表单 ---------- */

.field { margin-bottom: var(--hy-space-4); }

.field label {
    display: block;
    font-size: 13px;
    color: var(--hy-text-muted);
    margin-bottom: var(--hy-space-1);
}

.field input {
    width: 100%;
    padding: 10px 12px;
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-sm);
    transition: border-color var(--hy-transition);
}

.field input:focus { outline: none; border-color: var(--hy-accent); }

.field-row {
    display: flex;
    gap: var(--hy-space-2);
}

.field-row input { flex: 1; }
.field-row .btn { white-space: nowrap; }

.form-feedback {
    min-height: 20px;
    font-size: 13px;
    margin-bottom: var(--hy-space-2);
}

.form-feedback.error { color: var(--hy-danger); }
.form-feedback.success { color: var(--hy-success); }

.tabline {
    display: flex;
    gap: var(--hy-space-2);
    margin-bottom: var(--hy-space-4);
    border-bottom: 1px solid var(--hy-border);
}

.tabline button {
    border: none;
    background: none;
    color: var(--hy-text-muted);
    padding: 8px 2px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}

.tabline button.active {
    color: var(--hy-text);
    border-bottom-color: var(--hy-accent);
}

/* ---------- Toast ---------- */

#toast-root {
    position: fixed;
    top: calc(var(--hy-topbar-h) + var(--hy-space-3));
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--hy-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--hy-space-2);
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    background: var(--hy-surface-2);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-md);
    box-shadow: var(--hy-shadow-2);
    padding: 10px 16px;
    font-size: 14px;
    animation: hy-pop var(--hy-transition);
}

.toast.error { border-color: var(--hy-danger); color: var(--hy-danger); }
.toast.success { border-color: var(--hy-success); color: var(--hy-success); }
