* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-gradient-start: #fff5f7;
    --bg-gradient-end: #ffe4ed;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #5d3a4b;
    --text-secondary: #b86b84;
    --border-color: #ffe0e8;
    --btn-bg: #f8cedb;
    --btn-primary: #f29bb8;
    --shadow-color: rgba(176, 70, 100, 0.15);
    --footer-bg: rgba(255, 248, 250, 0.9);
}

body.dark {
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --card-bg: rgba(30, 30, 46, 0.75);
    --text-primary: #e8e8e8;
    --text-secondary: #c9b6d0;
    --border-color: #2a2a3e;
    --btn-bg: rgba(30, 30, 46, 0.6);
    --btn-primary: #9b59b6;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --footer-bg: rgba(30, 30, 46, 0.85);
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
}

body {
    background: linear-gradient(145deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    font-family: 'Segoe UI', 'Quicksand', system-ui, -apple-system, sans-serif;
    padding: 0.8rem;
    color: var(--text-primary);
    min-height: 100vh;
    transition: all 0.3s ease;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 0.35;
    z-index: -2;
    pointer-events: none;
}

@media (max-width: 768px) {
    body::before {
        background-image: url('../images/bgmobile.jpg');
        opacity: 0.4;
    }
    body {
        padding: 0.6rem;
    }
}

body.dark::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: pageFadeIn 0.5s ease;
}

@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 头部 */
.hero {
    text-align: center;
    margin-bottom: 1.2rem;
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(8px);
    border-radius: 50px;
    padding: 0.8rem;
    animation: fadeInDown 0.5s ease;
}

.hero h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #e8809e, #c95c7c);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

body.dark .hero h1 {
    background: linear-gradient(135deg, #d99bb8, #b86b9e);
    background-clip: text;
    -webkit-background-clip: text;
}

.hero p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.quick-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    animation: fadeInUp 0.5s ease 0.1s both;
}

.quick-item {
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.quick-item:hover {
    background: var(--btn-primary);
    color: white;
    transform: translateY(-2px);
}

.tool-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tool-btn {
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tool-btn:hover {
    background: var(--btn-primary);
    color: white;
    transform: translateY(-2px);
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 40px;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    font-size: 0.85rem;
    outline: none;
    color: var(--text-primary);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #f5a3bd;
    box-shadow: 0 0 0 2px rgba(245, 163, 189, 0.2);
}

.btn {
    background: var(--btn-bg);
    border: none;
    padding: 10px 18px;
    border-radius: 40px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(4px);
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--btn-primary);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
}

/* 分类导航 */
.category-nav-wrapper {
    margin-bottom: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.category-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 4px;
    min-width: min-content;
}

.category-chip {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

.category-chip:hover,
.category-chip.active {
    background: var(--btn-primary);
    color: white;
}

.category-chip:active {
    transform: scale(0.94);
}

/* 书签区域 */
.category-section {
    margin-bottom: 2rem;
}

.category-header {
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border-color);
}

.category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.category-icon {
    font-size: 1.2rem;
}

.category-title h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.subcategory-section {
    margin-bottom: 1.5rem;
}

.subcategory-header {
    margin-bottom: 0.6rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--btn-primary);
}

.subcategory-title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: inline-block;
}

.subcategory-count {
    background: var(--border-color);
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 0.6rem;
    margin-left: 8px;
}

.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.8rem;
}

.bookmark-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 0.8rem;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    box-shadow: 0 4px 12px -8px var(--shadow-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    backdrop-filter: blur(8px);
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.bookmark-card:hover {
    transform: translateY(-2px);
}

.bookmark-info {
    flex: 1;
    min-width: 0;
}

.bookmark-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-url {
    font-size: 0.6rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.bookmark-desc {
    font-size: 0.55rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
}

.icon-btn {
    background: var(--btn-bg);
    border: none;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 30px;
    color: var(--text-secondary);
    transition: 0.15s;
}

.icon-btn:hover {
    background: var(--btn-primary);
    color: white;
}

/* 留言区域 */
.messages-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.messages-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.message-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    backdrop-filter: blur(8px);
}

.message-card:hover {
    transform: translateX(4px);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.message-nickname {
    font-weight: bold;
    color: var(--btn-primary);
}

.message-time {
    color: var(--text-secondary);
    opacity: 0.7;
}

.message-content {
    line-height: 1.4;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

.message-url a {
    color: var(--btn-primary);
    text-decoration: none;
    font-size: 0.65rem;
    word-break: break-all;
}

/* Footer */
.footer {
    margin-top: 2rem;
    background: var(--footer-bg);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.footer-content {
    padding: 1rem;
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--border-color);
    display: inline-block;
}

.footer-section {
    margin-bottom: 1rem;
}

.footer-section h4 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.about-text {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    border-left: 3px solid var(--btn-primary);
}

.about-text p {
    margin-bottom: 0.3rem;
    line-height: 1.5;
    font-size: 0.75rem;
}

.reward-btn {
    background: var(--btn-primary);
    color: white;
    border: none;
    padding: 5px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.7rem;
    margin-top: 0.3rem;
}

.owner-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.3rem;
}

.owner-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 0.6rem;
    flex: 1;
    min-width: 100px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    text-align: center;
}

.owner-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 0.4rem;
    overflow: hidden;
    background: #f8cedb;
}

.owner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.owner-card .owner-name {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--btn-primary);
}

.owner-card .owner-desc {
    font-size: 0.6rem;
    color: var(--text-secondary);
}

.footer-bottom {
    padding: 0.6rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 0.6rem;
    color: var(--text-secondary);
    background: var(--card-bg);
}

/* 弹窗 */
.reward-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1001;
    justify-content: center;
    align-items: center;
}

.reward-modal.active {
    display: flex;
}

.reward-modal-content {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 1.2rem;
    width: 85%;
    max-width: 340px;
    text-align: center;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.reward-modal-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.reward-qrcode {
    background: white;
    padding: 0.8rem;
    border-radius: 16px;
    margin: 0.8rem 0;
}

.reward-qrcode img {
    width: 160px;
    height: 160px;
    object-fit: contain;
}

.reward-tip {
    font-size: 0.7rem;
}

.close-reward {
    background: var(--btn-bg);
    padding: 6px 18px;
    border-radius: 30px;
    margin-top: 0.8rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 1.2rem;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--border-color);
    animation: modalSlideIn 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 0.8rem;
    border-radius: 30px;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.modal-content textarea {
    border-radius: 16px;
    resize: vertical;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* 统计栏 */
.stats-bar {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 30px;
    backdrop-filter: blur(4px);
}

.loading {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--btn-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 99;
    opacity: 0.9;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.back-to-top:hover {
    transform: translateY(-4px) scale(1.08);
    opacity: 1;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.back-to-top:active {
    transform: translateY(2px) scale(0.92);
    transition: all 0.08s ease;
}

mark {
    background: #f5bfd1;
    border-radius: 4px;
    padding: 0 2px;
}

body.dark mark {
    background: #9b59b6;
    color: white;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* 移动端适配 */
@media (max-width: 640px) {
    body {
        padding: 0.8rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .quick-items {
        justify-content: center;
        order: 2;
    }

    .tool-buttons {
        justify-content: center;
        order: 1;
    }

    .bookmarks-grid {
        gap: 0.6rem;
        grid-template-columns: 1fr;
    }

    .bookmark-card {
        padding: 0.6rem;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .bookmark-info {
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    .bookmark-title {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .bookmark-url {
        font-size: 0.6rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .bookmark-desc {
        font-size: 0.55rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .subcategory-title {
        font-size: 0.9rem;
        max-width: calc(100% - 50px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
    }

    .category-chip {
        padding: 5px 12px;
        font-size: 0.75rem;
    }

    .tool-btn,
    .quick-item {
        padding: 5px 12px;
        font-size: 0.7rem;
    }

    .footer-content {
        padding: 0.8rem;
    }

    .owner-info {
        flex-direction: column;
    }

    .owner-card {
        min-width: auto;
    }

    .back-to-top {
        bottom: 18px;
        right: 18px;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
        z-index: 9999;
    }
    .back-to-top:active {
        transform: translateY(2px) scale(0.9);
    }

    .reward-modal-content {
        width: 90%;
        max-width: 320px;
        margin: 0 auto;
        left: auto;
        right: auto;
    }
}
/* ========== 全局加载动画 ========== */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fff5f7 0%, #ffe4ed 100%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

body.dark .global-loader {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.global-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-container {
    text-align: center;
}

.loader-ring {
    display: inline-block;
    width: 60px;
    height: 60px;
    margin: 0 5px;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: ring 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-ring:nth-child(1) {
    border-top-color: #f29bb8;
    animation-delay: 0s;
}

.loader-ring:nth-child(2) {
    border-right-color: #e8809e;
    animation-delay: 0.2s;
}

.loader-ring:nth-child(3) {
    border-bottom-color: #c95c7c;
    animation-delay: 0.4s;
}

@keyframes ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loader-text {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #b86b84;
    font-weight: 500;
    letter-spacing: 1px;
    animation: pulse 1.5s ease-in-out infinite;
}

body.dark .loader-text {
    color: #c9b6d0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

@media (max-width: 640px) {
    .loader-ring {
        width: 45px;
        height: 45px;
    }
    .loader-text {
        font-size: 0.8rem;
        margin-top: 15px;
    }
}
/* 返回按钮出现动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

/* 返回按钮消失动画 */
@keyframes fadeOutDown {
    from {
        opacity: 0.9;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}