/* 视图级样式：集市卡片、旅程列表、动态、个人中心 */

/* ---------- 集市：全宽主页 ---------- */

.market-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--hy-space-5);
    align-items: start;
}

@media (min-width: 1200px) {
    .market-body { grid-template-columns: minmax(0, 1fr) 320px; }
}

.market-main { min-width: 0; }

.market-toolbar {
    display: flex;
    gap: var(--hy-space-2);
    margin-bottom: var(--hy-space-3);
    flex-wrap: wrap;
}

.market-toolbar .search {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: var(--hy-space-2);
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-pill);
    padding: 8px 16px;
    transition: border-color var(--hy-transition), box-shadow var(--hy-transition);
}

.market-toolbar .search:focus-within {
    border-color: var(--hy-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hy-accent) 14%, transparent);
}

.market-toolbar .search input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    min-width: 0;
}

.market-toolbar .sort-chips { flex-wrap: nowrap; }

/* 分类条：手机横滑、桌面换行 */
.cat-bar {
    display: flex;
    gap: var(--hy-space-2);
    margin-bottom: var(--hy-space-3);
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.cat-bar::-webkit-scrollbar { display: none; }

.cat-divider { flex-shrink: 0; width: 1px; background: var(--hy-border); margin: 4px 2px; }
.cat-chip { flex-shrink: 0; }

@media (min-width: 768px) {
    .cat-bar { flex-wrap: wrap; overflow-x: visible; }
}

/* 大分类 tab 样式 */
.cat-main { font-weight: 600; }
.subcats { padding-top: 0; margin-top: calc(-1 * var(--hy-space-2)); }
.subcats .cat-chip { font-size: 12px; padding: 4px 12px; }

/* ---------- 轮播主视觉 ---------- */

.market-hero {
    position: relative;
    border-radius: var(--hy-radius-lg);
    overflow: hidden;
    border: 1px solid var(--hy-border);
    margin-bottom: var(--hy-space-5);
    aspect-ratio: 21 / 9;
    min-height: 260px;
    max-height: 420px;
    box-shadow: var(--hy-shadow-2);
}

.hero-track { position: relative; width: 100%; height: 100%; }

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.02);
    transition: opacity .6s ease, transform .8s ease;
    cursor: pointer;
    pointer-events: none;
}

.hero-slide.active { opacity: 1; transform: scale(1); pointer-events: auto; }

.hero-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(8, 10, 16, .88) 0%, rgba(8, 10, 16, .55) 40%, rgba(8, 10, 16, .08) 75%),
        linear-gradient(0deg, rgba(8, 10, 16, .55), transparent 40%);
}

.hero-info {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(58%, 640px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--hy-space-2);
    padding: var(--hy-space-5) var(--hy-space-6);
    color: #fff;
}

.hero-badge {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 600;
    color: #ffd9a8;
    background: rgba(225, 138, 36, .22);
    border: 1px solid rgba(225, 138, 36, .45);
    border-radius: var(--hy-radius-pill);
    padding: 2px 10px;
}

.hero-title {
    margin: 0;
    font-size: clamp(20px, 2.4vw, 30px);
    line-height: 1.25;
    text-shadow: 0 2px 12px rgba(0, 0, 0, .5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-desc {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, .72);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-stats { display: flex; gap: var(--hy-space-4); font-size: 12px; color: rgba(255, 255, 255, .65); flex-wrap: wrap; }

.hero-cta {
    align-self: flex-start;
    margin-top: var(--hy-space-1);
    font-size: 13px;
    font-weight: 600;
    color: var(--hy-accent-contrast);
    background: linear-gradient(135deg, var(--hy-accent), color-mix(in srgb, var(--hy-accent) 55%, #ff8e3c));
    border-radius: var(--hy-radius-pill);
    padding: 8px 20px;
    box-shadow: 0 4px 18px -6px rgba(0, 0, 0, .6);
}

.hero-dots {
    position: absolute;
    right: var(--hy-space-4);
    bottom: var(--hy-space-3);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.hero-dots button {
    width: 22px;
    height: 4px;
    border: none;
    border-radius: 2px;
    background: rgba(255, 255, 255, .3);
    transition: background var(--hy-transition), width var(--hy-transition);
}

.hero-dots button.active { background: #fff; width: 32px; }

@media (max-width: 640px) {
    .market-hero { aspect-ratio: 16 / 10; min-height: 200px; border-radius: var(--hy-radius-md); }
    .hero-info { padding: var(--hy-space-3) var(--hy-space-4); }
    .hero-desc { display: none; }
    .hero-stats { display: none; }
}

/* ---------- 榜单栏 ---------- */

.market-rail { display: none; }

@media (min-width: 1200px) {
    .market-rail { display: block; position: sticky; top: calc(var(--hy-topbar-h) + var(--hy-space-3)); }
}

.rank-card {
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    overflow: hidden;
}

.rank-head { padding: var(--hy-space-3) var(--hy-space-4) 0; }

.rank-title { font-weight: 700; font-size: 15px; }

.rank-tabs {
    display: flex;
    gap: var(--hy-space-1);
    padding: var(--hy-space-2) var(--hy-space-3) 0;
    border-bottom: 1px solid var(--hy-border);
}

.rank-tabs button {
    flex: 1;
    border: none;
    background: none;
    color: var(--hy-text-muted);
    font-size: 13px;
    padding: 8px 4px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--hy-transition), border-color var(--hy-transition);
}

.rank-tabs button.active { color: var(--hy-accent); border-bottom-color: var(--hy-accent); font-weight: 600; }

.rank-list {
    list-style: none;
    margin: 0;
    padding: var(--hy-space-2);
    max-height: 640px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: var(--hy-space-2);
    padding: 8px;
    border-radius: var(--hy-radius-md);
    cursor: pointer;
    transition: background var(--hy-transition);
}

.rank-item:hover { background: var(--hy-surface-2); }

.rank-num {
    width: 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    font-style: italic;
    color: var(--hy-text-faint);
    flex-shrink: 0;
}

.rank-num.n1 { color: #ffb940; }
.rank-num.n2 { color: #c9d3e3; }
.rank-num.n3 { color: #e0956a; }

.rank-cover {
    width: 42px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--hy-surface-2);
}

.rank-cover-fallback { display: grid; place-items: center; font-size: 20px; }

.rank-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.rank-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-heat { font-size: 11px; color: var(--hy-text-faint); }

.rank-empty { padding: var(--hy-space-4); color: var(--hy-text-muted); font-size: 13px; text-align: center; }

/* ---------- 作品网格：桌面四列 ---------- */

.world-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--hy-space-3);
}

@media (min-width: 640px) { .world-grid { grid-template-columns: repeat(2, 1fr); gap: var(--hy-space-4); } }
@media (min-width: 1024px) { .world-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .world-grid { grid-template-columns: repeat(4, 1fr); } }

/* 桌面富卡片：封面主导 + 悬停浮起 + 封面缓放 */
.world-card.rich {
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--hy-transition), border-color var(--hy-transition), box-shadow var(--hy-transition);
    display: flex;
    flex-direction: column;
}

.world-card.rich:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--hy-accent) 55%, var(--hy-border));
    box-shadow: var(--hy-shadow-2);
}

.world-card.rich .world-cover { aspect-ratio: 16 / 10; overflow: hidden; }

.world-card.rich .world-cover img { transition: transform .45s ease; }
.world-card.rich:hover .world-cover img { transform: scale(1.05); }

/* 手机紧凑形态（双列宫格）：统一 DOM，CSS 控制 */
@media (max-width: 639px) {
    .world-card.rich .world-cover { aspect-ratio: 3 / 4; }
    .world-card.rich .world-body { padding: var(--hy-space-2) var(--hy-space-2) var(--hy-space-3); gap: var(--hy-space-1); }
    .world-card.rich .world-title { font-size: 14px; -webkit-line-clamp: 1; }
    .world-card.rich .world-desc { display: none; }
    .world-card.rich .world-meta { font-size: 11px; gap: var(--hy-space-2); }
    .world-card.rich .world-meta span:nth-child(3), .world-card.rich .world-meta span:nth-child(4) { display: none; }
    .world-card.rich .world-badge { font-size: 10px; top: var(--hy-space-1); left: var(--hy-space-1); }
    .world-card.rich .world-price { font-size: 11px; padding: 1px 8px; top: var(--hy-space-1); right: var(--hy-space-1); }
    .world-card.rich .cover-fallback { font-size: 32px; }
    .world-card.rich:hover { transform: none; box-shadow: none; }
}

/* ---------- 详情页 ---------- */

.detail-hero {
    position: relative;
    border-radius: var(--hy-radius-lg);
    overflow: hidden;
    border: 1px solid var(--hy-border);
    margin-bottom: var(--hy-space-4);
}

.detail-hero img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; }

.detail-hero .cover-fallback {
    aspect-ratio: 21 / 9;
    display: grid;
    place-items: center;
    font-size: 56px;
    background: var(--hy-surface-2);
}

.detail-head { display: flex; flex-direction: column; gap: var(--hy-space-2); margin-bottom: var(--hy-space-4); }

.detail-title { font-size: 22px; font-weight: 700; margin: 0; }

.detail-stats { display: flex; gap: var(--hy-space-4); flex-wrap: wrap; color: var(--hy-text-muted); font-size: 13px; }

.detail-actions { display: flex; gap: var(--hy-space-2); margin: var(--hy-space-4) 0; flex-wrap: wrap; }

.detail-section { margin-bottom: var(--hy-space-5); }

.detail-section h3 { font-size: 15px; margin: 0 0 var(--hy-space-2); }

.detail-desc { white-space: pre-wrap; color: var(--hy-text-muted); font-size: 14px; }

/* ---------- 旅程 ---------- */

.session-list { display: flex; flex-direction: column; gap: var(--hy-space-3); }

.session-card {
    display: flex;
    align-items: center;
    gap: var(--hy-space-3);
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-md);
    padding: var(--hy-space-3) var(--hy-space-4);
}

.session-emoji {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: var(--hy-surface-2);
    border-radius: var(--hy-radius-md);
}

.session-main { flex: 1; min-width: 0; }

.session-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.session-sub { font-size: 12px; color: var(--hy-text-faint); display: flex; gap: var(--hy-space-2); flex-wrap: wrap; }

/* ---------- 动态 ---------- */

.feed-card {
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-md);
    padding: var(--hy-space-4);
    margin-bottom: var(--hy-space-3);
}

.feed-head { display: flex; align-items: center; gap: var(--hy-space-3); margin-bottom: var(--hy-space-2); }

.feed-head img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--hy-surface-2); }

.creator-row {
    display: flex;
    align-items: center;
    gap: var(--hy-space-3);
    padding: var(--hy-space-3) 0;
    border-bottom: 1px solid var(--hy-border);
}

.creator-row:last-child { border-bottom: none; }

.creator-row img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--hy-surface-2); }

.creator-row .creator-main { flex: 1; min-width: 0; }

/* ---------- 我的 ---------- */

.profile-head {
    display: flex;
    align-items: center;
    gap: var(--hy-space-4);
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    padding: var(--hy-space-5);
    margin-bottom: var(--hy-space-4);
}

.profile-head img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--hy-surface-2);
}

.profile-name { font-size: 18px; font-weight: 700; }

.profile-title-chip {
    font-size: 12px;
    color: var(--hy-accent);
    border: 1px solid var(--hy-accent);
    border-radius: var(--hy-radius-pill);
    padding: 1px 10px;
    display: inline-block;
    margin-top: var(--hy-space-1);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--hy-space-3);
    margin-bottom: var(--hy-space-4);
}

.stat-box {
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-md);
    padding: var(--hy-space-4);
    text-align: center;
}

.stat-box .stat-num { font-size: 20px; font-weight: 700; }

.stat-box .stat-label { font-size: 12px; color: var(--hy-text-faint); margin-top: 2px; }

.listing-status {
    font-size: 11px;
    padding: 1px 8px;
    border-radius: var(--hy-radius-pill);
    border: 1px solid var(--hy-border);
    color: var(--hy-text-muted);
    white-space: nowrap;
}

.listing-status.published { color: var(--hy-success); border-color: var(--hy-success); }
.listing-status.pending, .listing-status.reviewing { color: var(--hy-warning); border-color: var(--hy-warning); }
.listing-status.rejected, .listing-status.offline { color: var(--hy-danger); border-color: var(--hy-danger); }

/* ---------- 创作占位 ---------- */

.create-hero {
    text-align: center;
    padding: var(--hy-space-7) var(--hy-space-4);
    background: var(--hy-surface);
    border: 1px dashed var(--hy-border);
    border-radius: var(--hy-radius-lg);
    margin-bottom: var(--hy-space-5);
}

.create-hero .plus {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--hy-space-4);
    display: grid;
    place-items: center;
    font-size: 34px;
    font-weight: 700;
    color: var(--hy-accent-contrast);
    background: var(--hy-accent);
    border-radius: 50%;
    box-shadow: var(--hy-shadow-2);
}

.plan-list { list-style: none; padding: 0; margin: 0; }

.plan-list li {
    display: flex;
    gap: var(--hy-space-3);
    padding: var(--hy-space-3) 0;
    border-bottom: 1px solid var(--hy-border);
    color: var(--hy-text-muted);
    font-size: 14px;
}

.plan-list li:last-child { border-bottom: none; }

.plan-list .plan-check { color: var(--hy-success); font-weight: 700; }
.plan-list .plan-todo { color: var(--hy-text-faint); }

/* ---------- 登录弹窗补充 ---------- */

.auth-switch { text-align: center; font-size: 13px; color: var(--hy-text-muted); margin-top: var(--hy-space-3); }

.auth-switch button { border: none; background: none; color: var(--hy-accent); padding: 0; font-size: 13px; }

.agreement-line { font-size: 12px; color: var(--hy-text-faint); text-align: center; margin-top: var(--hy-space-2); }
