:root {
    --ink: #103246;
    --muted: #5f8394;
    --primary: #0876b8;
    --primary-dark: #064d7a;
    --accent: #13b3d8;
    --foam: rgba(255, 255, 255, 0.86);
    --foam-strong: rgba(255, 255, 255, 0.96);
    --line: rgba(8, 118, 184, 0.12);
    --shadow: 0 18px 46px rgba(5, 57, 92, 0.1);
    --soft-shadow: 0 10px 26px rgba(5, 57, 92, 0.07);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    background: #f7fcff;
}

body {
    min-height: 100vh;
    margin: 0;
    position: relative;
    isolation: isolate;
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    line-height: 1.65;
    background:
        radial-gradient(circle at 12% 6%, rgba(255, 255, 255, 0.96), transparent 26%),
        linear-gradient(115deg, rgba(255, 255, 255, 0.95), rgba(244, 252, 255, 0.88) 52%, rgba(255, 255, 255, 0.97)),
        #f7fcff;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url("../../src/decor/ocean-wave-gradient-1.jpg") center / cover no-repeat;
    opacity: 0.32;
    transform: translateZ(0);
    will-change: transform;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.home-body {
    padding: 32px 30px 36px 350px;
}

.page-shell {
    display: block;
    max-width: 1040px;
    margin: 0 auto;
}

.library-panel,
.profile-card,
.content-panel {
    border: 1px solid var(--line);
    background: var(--foam);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.library-panel {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 292px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding: 16px;
    border-radius: var(--radius);
    scrollbar-color: rgba(8, 118, 184, 0.45) rgba(255, 255, 255, 0.55);
    scrollbar-width: thin;
}

.library-panel::-webkit-scrollbar {
    width: 8px;
}

.library-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.56);
    border-radius: 99px;
}

.library-panel::-webkit-scrollbar-thumb {
    background: rgba(8, 118, 184, 0.42);
    border-radius: 99px;
}

.library-heading {
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.library-panel h2 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.34rem;
    line-height: 1.2;
}

.library-home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    margin-bottom: 14px;
    border: 1px solid rgba(8, 118, 184, 0.16);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--primary-dark);
    font-size: 0.95rem;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(5, 57, 92, 0.08);
}

.library-home-link:hover {
    background: rgba(255, 255, 255, 0.96);
    text-decoration: none;
    transform: translateY(-1px);
}

.library-search {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.library-search input {
    width: 100%;
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid rgba(8, 118, 184, 0.16);
    border-radius: 9px;
    outline: 0;
    background: rgba(255, 255, 255, 0.66);
    color: var(--ink);
    font: inherit;
}

.library-search input:focus {
    border-color: rgba(8, 118, 184, 0.42);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 3px rgba(19, 179, 216, 0.13);
}

.library-section {
    margin-top: 15px;
}

.library-section summary,
.content-panel h3 {
    position: relative;
    margin: 0 0 12px;
    padding-left: 16px;
    color: var(--primary);
    font-size: 1.08rem;
    line-height: 1.25;
}

.library-section summary::before,
.content-panel h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 72%;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent), var(--primary));
    transform: translateY(-50%);
}

.library-section summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0;
    padding: 8px 10px 8px 18px;
    border: 1px solid rgba(8, 118, 184, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.62);
    cursor: pointer;
    list-style: none;
    font-weight: 750;
}

.library-section summary::-webkit-details-marker {
    display: none;
}

.library-section summary::after {
    content: "⌄";
    color: var(--muted);
    font-size: 0.95rem;
    transform: rotate(-90deg);
    transition: transform 0.18s ease;
}

.library-section[open] summary {
    margin-bottom: 9px;
    background: rgba(255, 255, 255, 0.9);
}

.library-section[open] summary::after {
    transform: rotate(0deg);
}

.section-count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(8, 118, 184, 0.1);
    color: var(--primary-dark);
    font-size: 0.74rem;
    font-weight: 800;
}

.work-list {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.work-card {
    display: block;
    padding: 7px 9px;
    border: 1px solid rgba(8, 118, 184, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.62);
    box-shadow: 0 6px 16px rgba(5, 57, 92, 0.07);
}

.work-card:hover {
    transform: translateY(-1px);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 22px rgba(8, 118, 184, 0.13);
}

.work-title {
    display: block;
    color: #15445e;
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.36;
}

.profile-card {
    padding: clamp(20px, 3.5vw, 38px);
    border-radius: var(--radius);
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 184px;
    gap: clamp(22px, 5vw, 48px);
    align-items: center;
    min-height: 240px;
    margin-bottom: 20px;
    padding: clamp(24px, 4vw, 40px);
    border: 1px solid rgba(8, 118, 184, 0.14);
    border-radius: 18px;
    background:
        linear-gradient(125deg, rgba(255, 255, 255, 0.94), rgba(246, 253, 255, 0.84)),
        rgba(255, 255, 255, 0.72);
    box-shadow: var(--soft-shadow);
}

.hero-copy h1 {
    margin: 0;
    color: #0d3f5f;
    font-size: clamp(3rem, 8vw, 5.4rem);
    line-height: 1;
}

.hero-quote {
    margin: 18px 0 8px;
    color: var(--primary);
    font-family: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
    font-size: clamp(1.12rem, 2.2vw, 1.45rem);
}

.hero-panel img {
    width: 184px;
    height: 184px;
    border: 4px solid rgba(8, 118, 184, 0.86);
    border-radius: 50%;
    box-shadow: 0 12px 30px rgba(8, 118, 184, 0.22);
    object-fit: cover;
    transition: transform 0.25s ease;
}

.hero-panel img:hover {
    transform: rotate(4deg) scale(1.04);
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.content-panel {
    padding: 18px 20px;
    border-radius: 12px;
}

.home-grid .content-panel {
    margin-bottom: 0;
}

.about-panel {
    grid-column: 1 / -1;
}

.content-panel p {
    margin: 0 0 10px;
}

.content-panel p:last-child {
    margin-bottom: 0;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title-row h3 {
    margin-bottom: 0;
}

.section-title-row span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud span {
    padding: 5px 10px;
    border: 1px solid rgba(8, 118, 184, 0.13);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    color: #174a64;
    font-size: 0.88rem;
    font-weight: 700;
}

.license-note {
    margin-top: 18px;
    padding: 10px 12px;
    border-top: 1px solid rgba(8, 118, 184, 0.16);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.55;
    text-align: center;
}

.contact-list {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.contact-list li {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(8, 118, 184, 0.11);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.56);
}

.contact-list li span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.contact-list li a,
.contact-list li b {
    min-width: 0;
    color: var(--primary-dark);
    font-size: clamp(0.78rem, 1.05vw, 0.9rem);
    font-weight: 750;
    text-align: right;
    white-space: nowrap;
}

.playlist ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.playlist li {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: 0 4px 12px rgba(5, 57, 92, 0.09);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.playlist li:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 18px rgba(5, 57, 92, 0.13);
}

.playlist li.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.playlist li.active .artist,
.playlist li.active .duration {
    color: rgba(255, 255, 255, 0.82);
}

.cover {
    flex: 0 0 50px;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background-position: center;
    background-size: cover;
}

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

.title {
    margin-bottom: 4px;
    font-size: 1.05rem;
    font-weight: 650;
}

.artist,
.duration {
    color: var(--muted);
    font-size: 0.9rem;
}

.play-icon {
    width: 24px;
    height: 24px;
    background: var(--primary);
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>') no-repeat center;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>') no-repeat center;
}

.playlist li.active .play-icon {
    background: white;
}

audio {
    width: 100%;
    margin-top: 15px;
    filter: drop-shadow(0 5px 10px rgba(5, 57, 92, 0.12));
}

audio::-webkit-media-controls-panel {
    background: #e7f9ff;
}

.reader-body {
    padding: 28px 30px 46px 350px;
}

.reader-shell {
    max-width: 1220px;
    margin: 0 auto;
}

.reader-stage {
    min-height: calc(100vh - 112px);
}

.article-document {
    width: min(940px, 100%);
    margin: 0 auto;
    padding: clamp(34px, 6vw, 70px) clamp(20px, 6vw, 78px);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 20px 60px rgba(5, 57, 92, 0.16);
    color: #1e2f3b;
    font-family: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
    font-size: 1.08rem;
    line-height: 2.05;
    text-align: left;
}

.poem-document {
    width: min(760px, 100%);
    padding-top: clamp(46px, 7vw, 82px);
}

.article-document h1 {
    margin: 0 auto 34px;
    color: #123a52;
    font-size: clamp(2rem, 5vw, 2.8rem);
    line-height: 1.24;
    text-align: center;
}

.article-document h2,
.article-document h3 {
    margin: 28px auto 12px;
    color: var(--primary);
    text-align: center;
}

.article-document p {
    margin: 0 auto 12px;
    text-align: left;
}

.article-document .doc-paragraph,
.article-document .essay-paragraph {
    text-align: justify;
    text-indent: 2em;
}

.article-document .doc-subtitle {
    margin-top: -18px;
    margin-bottom: 26px;
    color: var(--muted);
    font-size: 0.96rem;
}

.article-document .doc-lead {
    color: #29495b;
    font-size: 1rem;
}

.article-document .doc-heading {
    margin-top: 34px;
    color: var(--primary-dark);
    font-size: clamp(1.28rem, 3vw, 1.62rem);
    line-height: 1.45;
}

.article-document .doc-list-line {
    max-width: 92%;
}

.markdown-document {
    text-align: left;
}

.markdown-document h1 {
    text-align: center;
}

.markdown-document h2,
.markdown-document h3,
.markdown-document h4,
.markdown-document p,
.markdown-document li {
    text-align: left;
}

.markdown-document table {
    width: 100%;
    margin: 18px 0;
    border-collapse: collapse;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.92rem;
    line-height: 1.55;
    background: rgba(255, 255, 255, 0.74);
}

.markdown-document th,
.markdown-document td {
    padding: 9px 10px;
    border: 1px solid rgba(8, 118, 184, 0.16);
    text-align: left;
}

.markdown-document th {
    background: rgba(8, 118, 184, 0.08);
    color: var(--primary-dark);
}

.markdown-document img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 20px auto;
    border-radius: 6px;
    box-shadow: 0 10px 26px rgba(5, 57, 92, 0.12);
}

.markdown-document pre {
    overflow-x: auto;
    padding: 14px;
    border-radius: 8px;
    background: rgba(7, 49, 77, 0.92);
    color: #eefbff;
    text-align: left;
}

.article-document .poem-lines {
    margin-top: 28px;
    font-size: clamp(1.2rem, 2.8vw, 1.48rem);
    line-height: 2.18;
    text-align: center;
}

.article-document .poem-lines p {
    text-align: center;
    text-indent: 0;
}

.article-document .poem-date {
    margin-top: -16px;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: center;
}

.article-document .poem-note {
    max-width: 620px;
    margin-top: 24px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.8;
    text-align: center;
}

.article-document .signature {
    width: min(230px, 52%);
    margin: 34px 0 0 auto;
}

.article-document .signature p {
    text-align: right;
    text-indent: 0;
}

.pdf-document {
    min-height: calc(100vh - 112px);
}

.pdf-viewer {
    display: block;
    width: 100%;
    min-height: calc(100vh - 112px);
    border: 0;
    border-radius: 0;
    background: transparent;
}

.reader-error {
    max-width: 720px;
    margin: 40px auto;
    padding: 18px;
    border: 1px solid rgba(190, 53, 53, 0.16);
    border-radius: 8px;
    background: rgba(255, 244, 244, 0.92);
    color: #a42a2a;
    font-weight: 700;
}

@media (max-width: 860px) {
    .home-body,
    .reader-body {
        padding: 20px 14px;
    }

    .page-shell {
        display: block;
    }

    .library-panel {
        position: relative;
        top: auto;
        left: auto;
        width: auto;
        max-height: 420px;
        margin-bottom: 22px;
        padding: 18px;
    }

    .hero-panel {
        grid-template-columns: 1fr;
        min-height: auto;
        text-align: center;
    }

    .hero-panel img {
        grid-row: 1;
        justify-self: center;
        width: 142px;
        height: 142px;
    }

    .home-grid {
        grid-template-columns: 1fr;
    }

    .contact-list li {
        grid-template-columns: 62px minmax(0, 1fr);
    }

    .contact-list li a,
    .contact-list li b {
        white-space: normal;
    }

    .profile-card {
        padding: 24px;
    }

    .playlist ul {
        grid-template-columns: 1fr;
    }
    
    .playlist li {
        gap: 10px;
    }

    .duration {
        display: none;
    }

    .article-document {
        padding: 32px 18px 42px;
        font-size: 1rem;
    }
}

@media (min-width: 861px) and (max-width: 1160px) {
    .home-body,
    .reader-body {
        padding-left: 330px;
    }

    .playlist ul {
        grid-template-columns: 1fr;
    }
}
