/* ===== 前台导航样式 ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sd-text: #2d3748;
    --sd-muted: #94a3b8;
    --sd-card-bg: #ffffff;
    --sd-border: #e8ecf1;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--sd-bg);
    color: var(--sd-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* 主页背景图层（独立于内容，不透明度可调） */
.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: var(--sd-bg-image);
    background-size: var(--sd-bg-size);
    background-position: var(--sd-bg-position);
    background-repeat: var(--sd-bg-repeat);
    opacity: var(--sd-bg-opacity);
}

/* ===== 顶部 ===== */
.topbar {
    padding: 28px 0 8px;
}

.topbar-inner {
    max-width: var(--sd-max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .5px;
}

/* 用户菜单 */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}
.um-link {
    color: var(--sd-muted);
    display: inline-flex;
    padding: 7px;
    border-radius: 8px;
    transition: all .18s;
}
.um-link:hover {
    color: var(--sd-accent);
    background: rgba(0, 0, 0, .05);
}
.um-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--sd-text);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.um-btn {
    font-size: 13px;
    font-weight: 600;
    color: var(--sd-accent);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--sd-accent);
    border-radius: 999px;
    transition: all .15s;
}
.um-btn:hover {
    background: rgba(74, 108, 247, .08);
}
.um-primary {
    background: var(--sd-accent);
    color: #fff;
}
.um-primary:hover {
    background: #3b5ce0;
}

/* ===== 分组标签 ===== */
.group-tabs {
    max-width: var(--sd-max-width);
    margin: 18px auto 0;
    padding: 0 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    border: 1px solid var(--sd-border);
    background: var(--sd-card-bg);
    color: var(--sd-text);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .18s;
    font-family: inherit;
}

.tab:hover {
    border-color: var(--sd-accent);
    color: var(--sd-accent);
}

.tab.active {
    background: var(--sd-accent);
    border-color: var(--sd-accent);
    color: #fff;
}

.tab .count {
    font-size: 11px;
    background: rgba(0, 0, 0, .08);
    border-radius: 999px;
    padding: 1px 7px;
    line-height: 1.5;
}

.tab.active .count {
    background: rgba(255, 255, 255, .25);
}

/* 本站推荐：非激活时用强调色淡描边做轻微区分 */
.tab-recommend {
    border-color: color-mix(in srgb, var(--sd-accent) 45%, var(--sd-border));
}

/* 个人分组 tab 可拖拽 */
.tab-group { cursor: grab; }
.tab-group.dragging { opacity: .45; }

/* ===== 内容网格 ===== */
.content {
    max-width: var(--sd-max-width);
    margin: 0 auto;
    padding: 24px 24px 48px;
}

.dial-grid {
    display: grid;
    grid-template-columns: var(--sd-grid-template);
    gap: var(--sd-gap);
}

/* ===== 书签卡片 ===== */
.dial-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--sd-card-bg);
    border: 1px solid var(--sd-border);
    border-radius: var(--sd-radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--sd-text);
    padding: 6px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

.dial-card:hover {
    transform: translateY(calc(-1 * var(--sd-hover-lift)));
    box-shadow: 0 calc(var(--sd-hover-shadow) * 0.45) var(--sd-hover-shadow) rgba(16, 24, 40, .13);
    border-color: rgba(74, 108, 247, .35);
}

/* 缩略图区域：浅灰底、固定比例，图片完整显示不裁剪 */
.thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #e8e8e8;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: var(--sd-thumb-pad-top) var(--sd-thumb-pad-right)
             var(--sd-thumb-pad-bottom) var(--sd-thumb-pad-left);
    box-sizing: border-box;
}

/* 老浏览器兜底：不支持 aspect-ratio 时给缩略图区一个最小高度，避免塌陷 */
@supports not (aspect-ratio: 16 / 9) {
    .thumb {
        aspect-ratio: auto;
        min-height: 120px;
    }
}

.shot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: var(--sd-thumb-radius);
    transition: transform .3s ease;
}

.dial-card:hover .shot-img {
    transform: scale(1.04);
}

.globe-icon {
    color: #b8c0cc;
    display: inline-flex;
}

/* 文字区域：白色背景、标题居中，与缩略图上下分开 */
.meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px 8px;
    min-height: 38px;
}

.favicon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 3px;
}

.title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2430;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* 隐藏状态（分组过滤） */
.dial-card.hidden {
    display: none;
}

/* 拖拽排序 */
.dial-card {
    cursor: grab;
}
.dial-card:active {
    cursor: grabbing;
}
.dial-card.dragging {
    opacity: .5;
    cursor: grabbing;
    box-shadow: 0 8px 22px rgba(16, 24, 40, .18);
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 90px 0;
    color: var(--sd-muted);
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 12px;
}

.empty-state a {
    color: var(--sd-accent);
    text-decoration: none;
    font-weight: 600;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .topbar { padding-top: 20px; }
    .page-title { font-size: 18px; }
    .content { padding: 16px 16px 40px; }
    .group-tabs { padding: 0 16px; }
    .topbar-inner { padding: 0 16px; }
    .dial-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
}

/* ===== 反馈触发按钮与未读红点 ===== */
.feedback-trigger {
    position: relative;
    border: none;
    background: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
}
.fb-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    display: none;
}
.fb-badge.show { display: block; }

/* ===== 反馈弹窗 ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 86vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
}
.modal-head h3 { font-size: 17px; margin: 0; }
.modal-close {
    border: none;
    background: none;
    font-size: 24px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
}
.modal-close:hover { color: #475569; }
.fb-form {
    padding: 0 20px 14px;
    border-bottom: 1px solid #eef0f3;
}
.fb-form textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #d8dde6;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}
.fb-form textarea:focus { border-color: var(--sd-accent); }
.fb-submit { margin-top: 10px; width: 100%; }
.fb-list {
    padding: 12px 20px 18px;
    overflow-y: auto;
}
.fb-loading, .fb-empty { color: #94a3b8; font-size: 13px; text-align: center; padding: 14px 0; }
.fb-item {
    border: 1px solid #eef0f3;
    border-radius: 10px;
    padding: 11px 13px;
    margin-bottom: 10px;
}
.fb-content { font-size: 13px; color: #1f2937; line-height: 1.6; word-break: break-word; }
.fb-time { display: block; color: #a0a8b5; font-size: 11px; margin-top: 5px; }
.fb-reply {
    margin-top: 9px;
    padding: 9px 11px;
    background: #f5f8ff;
    border-radius: 8px;
}
.fb-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--sd-accent);
    margin-bottom: 3px;
}
.fb-reply div { font-size: 13px; color: #334155; line-height: 1.6; word-break: break-word; }
.fb-pending { font-size: 12px; color: #a0a8b5; margin-top: 8px; }
