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

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
}

/* Background */
.bg-layer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
}

.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-color {
    background: var(--bg-color, #667eea);
}

.bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.bg-image::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
}

/* Ambient particles */
.particles {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

/* Main container */
.container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Avatar */
.avatar-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.avatar-ring {
    position: absolute;
    top: -6px; left: -6px; right: -6px; bottom: -6px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.1));
    animation: ring-rotate 8s linear infinite;
}

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

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.15),
        0 0 40px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.15),
        0 0 40px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: rgba(255, 255, 255, 0.7);
}

/* Title area */
.title-area {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeInUp 0.8s ease both;
}

.site-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.site-subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    font-weight: 400;
}

/* Links container */
.links-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Link card */
.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    text-decoration: none;
    color: #fff;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.link-card:nth-child(1) { animation-delay: 0.1s; }
.link-card:nth-child(2) { animation-delay: 0.2s; }
.link-card:nth-child(3) { animation-delay: 0.3s; }
.link-card:nth-child(4) { animation-delay: 0.4s; }
.link-card:nth-child(5) { animation-delay: 0.5s; }
.link-card:nth-child(6) { animation-delay: 0.6s; }
.link-card:nth-child(7) { animation-delay: 0.7s; }
.link-card:nth-child(8) { animation-delay: 0.8s; }

.link-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: 0; bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 0.6s ease;
}

.link-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.12),
        0 4px 12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.link-card:hover::before {
    left: 100%;
}

.link-card:active {
    transform: translateY(-1px);
    transition-duration: 0.1s;
}

.link-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.link-card:hover .link-icon {
    transform: scale(1.08);
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

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

.link-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.link-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-arrow {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    opacity: 0.4;
    transition: all 0.3s ease;
}

.link-card:hover .link-arrow {
    opacity: 0.8;
    transform: translateX(3px);
}

/* Footer */
.footer {
    margin-top: 40px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    animation: fadeInUp 0.8s ease 0.8s both;
}

.footer a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: rgba(255, 255, 255, 0.8);
}

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

/* Responsive */
@media (max-width: 480px) {
    body {
        padding: 32px 16px;
    }

    .site-title {
        font-size: 24px;
    }

    .link-card {
        padding: 14px 16px;
        border-radius: 14px;
    }

    .avatar, .avatar-placeholder {
        width: 80px;
        height: 80px;
    }

    .avatar-ring {
        top: -5px; left: -5px; right: -5px; bottom: -5px;
    }
}

/* Shimmer - flowing light on text */
.shimmer {
    position: relative;
    overflow: hidden;
    width: fit-content;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: -40%;
    width: 30%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(255,255,255,0) 25%,
        rgba(255,255,255,0.55) 50%,
        rgba(255,255,255,0) 75%,
        transparent 100%
    );
    animation: shimmer-flow 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer-flow {
    0%   { left: -40%; }
    100% { left: 110%; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Disabled (unpublished) card */
.link-card.disabled {
    filter: grayscale(0.7) brightness(0.92);
    cursor: not-allowed;
    pointer-events: none;
}

.link-card.disabled .link-desc {
    color: rgba(255, 255, 255, 0.55);
    white-space: normal;
}

/* ---------- Article page ---------- */
body.page-article {
    justify-content: flex-start;
}

.article-shell {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0 auto;
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    margin-bottom: 18px;
    transition: all 0.25s ease;
    animation: fadeInUp 0.5s ease both;
}

.article-back:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateX(-3px);
}

.article-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 32px 30px;
    color: #fff;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    animation: fadeInUp 0.6s ease 0.1s both;
}

.article-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.article-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.article-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.article-head-info {
    min-width: 0;
}

.article-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    margin-bottom: 4px;
    word-break: break-word;
}

.article-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.article-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    padding: 30px 0;
}

/* Rich text output */
.article-content {
    font-size: 15px;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.92);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.article-content > *:first-child { margin-top: 0; }
.article-content > *:last-child { margin-bottom: 0; }

.article-content p { margin: 0 0 1em; }

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: #fff;
    font-weight: 700;
    margin: 1.4em 0 0.6em;
    line-height: 1.4;
}

.article-content h1 { font-size: 23px; }
.article-content h2 { font-size: 20px; }
.article-content h3 { font-size: 17px; }
.article-content h4,
.article-content h5,
.article-content h6 { font-size: 15px; }

.article-content a {
    color: #ffe9a8;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-content a:hover { color: #fff; }

.article-content ul,
.article-content ol {
    margin: 0 0 1em;
    padding-left: 1.5em;
}

.article-content li { margin-bottom: 0.4em; }

.article-content blockquote {
    border-left: 3px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    margin: 0 0 1em;
    border-radius: 0 10px 10px 0;
    color: rgba(255, 255, 255, 0.78);
}

.article-content pre {
    background: rgba(0, 0, 0, 0.28);
    padding: 14px 16px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0 0 1em;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
}

.article-content code {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 14px 0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.article-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    margin: 1.8em 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1em;
    font-size: 14px;
}

.article-content th,
.article-content td {
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 12px;
    text-align: left;
}

.article-content th {
    background: rgba(255, 255, 255, 0.12);
    font-weight: 600;
}

.article-shell .footer {
    margin-top: 28px;
}

@media (max-width: 480px) {
    .article-card {
        padding: 24px 18px;
        border-radius: 16px;
    }

    .article-title {
        font-size: 21px;
    }

    .article-head {
        gap: 12px;
        padding-bottom: 16px;
        margin-bottom: 18px;
    }

    .article-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* ---------- Background music button ---------- */
.bgm-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 99;
    transition: transform 0.2s ease, background 0.2s ease;
}

.bgm-btn:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.3);
}

.bgm-btn:active {
    transform: scale(0.96);
}

.bgm-btn .bgm-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.bgm-btn .bgm-icon-pause,
.bgm-btn.playing .bgm-icon-play {
    display: none;
}

.bgm-btn.playing .bgm-icon-pause {
    display: block;
}

.bgm-btn.playing {
    animation: bgm-pulse 2s ease-in-out infinite;
}

@keyframes bgm-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 0 rgba(255, 255, 255, 0.5); }
    50% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), 0 0 0 9px rgba(255, 255, 255, 0); }
}
