:root {
    --ink-black: #1a1a1a;
    --ink-dark: #333333;
    --ink-mid: #666666;
    --ink-light: #999999;
    --ink-faint: #cccccc;
    --seal-red: #c23531;
    --seal-red-dark: #9e2724;
    --paper: #f5f0e8;
    --paper-warm: #ede6d7;
    --paper-dark: #e5ddc8;
    --card-bg: rgba(250, 247, 240, 0.65);
    --card-hover: rgba(255, 254, 249, 0.8);
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-dim: #999999;
    --border: rgba(180, 170, 150, 0.4);
    --border-hover: rgba(140, 130, 110, 0.6);
    --glass-blur: blur(5px);
    --glass-blur-light: blur(3px);
    --shadow: 0 2px 12px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.07);
    --radius: 10px;
    --radius-sm: 6px;
    --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'STSong', 'SimSun', serif;
}

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

html, body {
    width: 100%;
    min-height: 100%;
    background: var(--paper);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

#scene-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.85;
    touch-action: none;
}

#ink-surface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    touch-action: none;
}

/* ========== LOADING ========== */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.loader-ring {
    width: 52px;
    height: 52px;
    border: 3px solid var(--ink-faint);
    border-top-color: var(--ink-black);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loader-text {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.loader-title {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--ink-black);
}

.loader-sub {
    font-size: 14px;
    color: var(--ink-mid);
}

.loader-bar {
    width: 200px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.loader-progress {
    height: 100%;
    width: 0%;
    background: var(--ink-black);
    animation: loadPulse 2.5s ease-in-out infinite;
    border-radius: 2px;
}

@keyframes loadPulse {
    0% { width: 0%; }
    50% { width: 65%; }
    100% { width: 100%; }
}

/* ========== UI OVERLAY ========== */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

#center-content {
    pointer-events: auto;
}

/* ========== HEADER ========== */
#top-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 36px;
    background: rgba(245, 240, 232, 0.06);
    backdrop-filter: var(--glass-blur-light);
    -webkit-backdrop-filter: var(--glass-blur-light);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.logo-icon svg {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.logo-text h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    line-height: 1.1;
    color: var(--ink-black);
}

.logo-text h1 .accent {
    color: var(--seal-red);
    font-weight: 900;
}

.tagline {
    display: block;
    font-size: 12px;
    color: var(--ink-light);
    letter-spacing: 1px;
}

.search-box {
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: var(--glass-blur-light);
    -webkit-backdrop-filter: var(--glass-blur-light);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: rgba(26, 26, 26, 0.5);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(26,26,26,0.04);
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 22px;
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--text-primary);
    outline: none;
}

#search-input::placeholder {
    color: var(--ink-light);
}

#search-btn {
    background: var(--ink-black);
    border: none;
    color: #fff;
    padding: 13px 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

#search-btn:hover {
    background: var(--ink-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.sys-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--seal-red);
    flex-shrink: 0;
}

.dot.pulse {
    animation: dotPulse 3s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ========== MAIN CONTENT ========== */
#center-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 8%;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

#center-content::-webkit-scrollbar { width: 5px; }
#center-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ========== WELCOME ========== */
.welcome-row {
    text-align: center;
    padding: 28px 0 8px;
}

.welcome-greeting {
    font-size: 32px;
    font-weight: 700;
    color: var(--ink-black);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.welcome-sub {
    font-size: 16px;
    color: var(--ink-mid);
}

/* ========== HOT LINKS ROW ========== */
.hot-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 18px 0 28px;
}

.hot-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--ink-black);
    background: rgba(250, 247, 240, 0.08);
    backdrop-filter: var(--glass-blur-light);
    -webkit-backdrop-filter: var(--glass-blur-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s;
    box-shadow: var(--shadow);
    position: relative;
}

.hot-link-btn:hover {
    border-color: rgba(26, 26, 26, 0.4);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: rgba(255, 254, 249, 0.2);
}

.hot-link-btn .emoji {
    font-size: 22px;
    line-height: 1;
}

.hot-link-btn .hot-badge {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--seal-red);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 2px;
}

/* ========== CATEGORY GRID ========== */
.category-grid {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-bottom: 48px;
}

.category-section {
    background: rgba(250, 247, 240, 0.08);
    backdrop-filter: var(--glass-blur-light);
    -webkit-backdrop-filter: var(--glass-blur-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px 30px 22px;
    box-shadow: var(--shadow);
    position: relative;
}

.category-section::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 16px;
    width: 22px;
    height: 22px;
    border-radius: 2px;
    border: 1px solid rgba(194, 53, 49, 0.25);
    opacity: 0.5;
    pointer-events: none;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.category-icon {
    font-size: 38px;
    line-height: 1;
    opacity: 0.9;
}

.category-title {
    font-size: 23px;
    font-weight: 700;
    color: var(--ink-black);
    letter-spacing: 1px;
}

.category-desc {
    font-size: 14px;
    color: var(--ink-light);
    margin-left: 10px;
}

.category-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.25s;
    position: relative;
}

.link-card:hover {
    border-color: rgba(26, 26, 26, 0.35);
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.link-card::after {
    content: '';
    position: absolute;
    right: 18px;
    width: 5px;
    height: 5px;
    border-top: 1.5px solid var(--ink-light);
    border-right: 1.5px solid var(--ink-light);
    transform: translateY(-50%) rotate(45deg);
    opacity: 0;
    transition: opacity 0.3s;
}

.link-card:hover::after {
    opacity: 1;
}

.link-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f5f0e8, #e8e0d0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    transition: all 0.25s;
    border: 1px solid var(--border);
}

.link-card:hover .link-icon {
    background: linear-gradient(135deg, #f0e8d8, #e8dcc5);
}

.link-info {
    min-width: 0;
}

.link-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--ink-black);
    line-height: 1.3;
}

.link-desc {
    font-size: 13px;
    color: var(--ink-light);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== FOOTER ========== */
#bottom-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 20px;
    background: rgba(245, 240, 232, 0.06);
    backdrop-filter: var(--glass-blur-light);
    -webkit-backdrop-filter: var(--glass-blur-light);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.divider {
    color: var(--ink-light);
    opacity: 0.5;
    font-size: 12px;
}

/* ========== ACCESSIBILITY ========== */
.link-card:focus-visible,
.hot-link-btn:focus-visible,
#search-input:focus-visible {
    outline: 3px solid var(--ink-dark);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    #center-content {
        padding: 20px 4%;
    }

    .category-links {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    #top-bar {
        padding: 12px 18px;
        gap: 12px;
    }

    .logo-text h1 { font-size: 24px; }
    .tagline { display: none; }
}

@media (max-width: 640px) {
    #center-content {
        padding: 14px 10px;
    }

    .welcome-greeting { font-size: 24px; }
    .welcome-sub { font-size: 14px; }

    .category-links {
        grid-template-columns: 1fr;
    }

    .search-box { max-width: none; }

    .header-right #date-display { display: none; }

    .hot-links { gap: 8px; }
    .hot-link-btn { padding: 10px 14px; font-size: 14px; }

    .category-section { padding: 20px 14px 14px; }
    .category-title { font-size: 19px; }
    .category-icon { font-size: 30px; }

    #top-bar { justify-content: space-between; }
    .welcome-row { padding: 10px 0 6px; }
}

/* ========== SEARCH HIGHLIGHT ========== */
.link-card.highlight-search {
    border-color: var(--seal-red);
    border-width: 2px;
    background: rgba(254, 249, 247, 0.15);
    box-shadow: var(--shadow);
}

.link-card.dimmed {
    opacity: 0.25;
    pointer-events: none;
}
