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

body {
    font-family: 'Yu Mincho', 'YuMincho', 'Hiragino Mincho Pro', 'MS PMincho', serif;
    background: #161926;
    min-height: 100vh;
    color: #e8e8e8;
    line-height: 1.8;
    font-size: 16px;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

/* 背景テクスチャ */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        linear-gradient(120deg, rgba(30,36,47,0.96) 0%, rgba(34,41,52,0.97) 100%),
        url('https://www.transparenttextures.com/patterns/symphony.png'),
        radial-gradient(circle at 60% 80%, rgba(255,210,70,0.08) 0%, transparent 75%),
        radial-gradient(circle at 15% 22%, rgba(140,187,255,0.10) 0%, transparent 55%);
    background-blend-mode: hard-light, normal, lighten;
    pointer-events: none;
    z-index: -1;
    opacity: 0.95;
    filter: blur(0.5px) saturate(0.97);
}

/* === 固定ヘッダー === */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    z-index: 120;
    background: rgba(30,34,48, 0.98);
    padding: 34px 0 12px 0;
    box-shadow: 0 4px 24px rgba(22,22,33,0.12), 0 1.5px 0 rgba(255,255,255, 0.08);
    border-bottom: 1.6px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* スクロール領域 */
.text-scroll-area {
    margin-top: 216px; /* ヘッダー高さ分あける（可変の場合: JSまたはmin-heightで調整） */
    /* ↑h1(48)+author(24)+counter(24)+上下padding+citation=合計で200px以上 */
    padding: 0 0 60px 0;
    background: none;
    min-height: 440px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    box-sizing: border-box;
}

/* 本文背景・装飾等は.text-displayから.text-scroll-area/.text-contentへ */
.text-content {
    font-size: 18px;
    line-height: 2;
    text-align: justify;
    position: relative;
    background: rgba(26, 30, 44, 0.88);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 60px;
    box-shadow: 
        0 12px 36px 0 rgba(24, 24, 30, 0.38),
        0 1.5px 0 rgba(255,255,255, 0.12);
    overflow: hidden;
    animation: fadeInUp 1.2s ease-out;
}

.text-content::before {
    content: '';
    position: absolute;
    top: 6%;
    left: 60%;
    width: 220px;
    height: 120px;
    background: radial-gradient(ellipse at center, rgba(255,255,240,0.08) 0%, rgba(255,240,180,0.016) 70%, transparent 100%);
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%,-50%) rotate(-12deg);
    filter: blur(2.5px);
}

.title {
    font-size: 3rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffd700, #ff8c00, #ff6347);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    letter-spacing: 0.1em;
    animation: titleGlow 3s ease-in-out infinite alternate;
}

.author {
    text-align: center;
    font-size: 1.2rem;
    color: #b8b8b8;
    margin-bottom: 13px;
    font-weight: 300;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.text-content p {
    margin-bottom: 30px;
    text-indent: 1em;
    opacity: 0;
    animation: textFadeIn 0.8s ease-out forwards;
    animation-delay: calc(var(--i, 0) * 0.1s);
    transition: all 0.3s ease;
    position: relative;
    padding: 15px 0;
    background: transparent;
    color: #eaeaeb;
    text-shadow: 0 1.5px 1.5px #12131a1c, 0 0 1px #181a2430;
}
.text-content p:hover {
    transform: translateX(10px);
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    background: rgba(255, 252, 230, 0.07);
    color: #fffefb;
}
.text-content p:nth-child(odd) {
    --i: 1;
}
.text-content p:nth-child(even) {
    --i: 2;
}

/* 詩部分 */
.poem {
    background: rgba(30,32,49, 0.72);
    border-left: 4px solid #ffd700;
    padding: 30px;
    margin: 40px 0;
    border-radius: 10px;
    font-style: italic;
    position: relative;
    box-shadow: 0 7px 18px rgba(22, 22, 33, 0.21);
    backdrop-filter: blur(5px);
}
.poem::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 4rem;
    color: #ffd700;
    opacity: 0.3;
    font-family: serif;
}
.poem p {
    margin-bottom: 15px;
    text-indent: 0;
    text-align: center;
    font-family: 'Times New Roman', serif;
    color: #f0f0f0;
    letter-spacing: 0.05em;
}

/* Citation右上に配置、かつheader内で邪魔しないよう */
.citation-topright {
    position: absolute;
    top: 16px;
    right: 18px;
    color: #b8b8b8;
    font-size: 1em;
    background: rgba(30, 35, 48, 0.74);
    border-radius: 999px;
    padding: 6px 18px 6px 16px;
    z-index: 40;
    box-shadow: 0 0 12px rgba(140,140,120,0.07);
    letter-spacing: 0.01em;
    opacity: 0.95;
}
.citation-topright a {
    color: #ffd700;
    text-decoration: underline;
}

/* 文字カウンター (headerで右寄せ,やや目立たせる) */
.text-counter {
    position: relative;
    text-align: right;
    margin-bottom: 10px;
    color: #c1be8a;
    font-size: 1rem;
    background: none;
    font-family: system-ui, 'Yu Mincho', serif;
    opacity: 0.86;
    letter-spacing: 0.03em;
    width: 99%;
    z-index: 2;
}

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

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

@keyframes titleGlow {
    from {
        text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    }
    to {
        text-shadow: 0 0 50px rgba(255, 215, 0, 0.6);
    }
}

/* Ruby text styling for Japanese pronunciation guides */
ruby {
    font-size: 0.9em;
}
rt {
    font-size: 0.6em;
    color: #d4d4aa;
    opacity: 0.7;
}

/* --- ボタンとレスポンシブ等は従来通り --- */
.read-more-btn {
    display: block;
    margin: 40px auto 0 auto;
    padding: 14px 38px;
    font-size: 1.15rem;
    background: linear-gradient(90deg,#ffd700,#ff8c00,#ff6347);
    border: none;
    border-radius: 42px;
    color: #222;
    font-family: inherit;
    font-weight: bold;
    box-shadow: 0 3px 16px rgba(255,215,0,0.20);
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: all 0.21s;
}
.read-more-btn:hover {
    background: linear-gradient(90deg,#ff8c00,#ffd700,#ff6347);
    color: #000;
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(255,215,0,0.31);
}

/* Responsive design */
@media (max-width: 768px) {
    .fixed-header {
        padding: 14px 0 5px 0;
    }
    .container {
        max-width: 99vw;
    }
    .title {
        font-size: 2rem;
    }
    .text-content {
        font-size: 16px;
        line-height: 1.9;
        padding: 30px 14px 30px 14px;
        border-radius: 15px;
    }
    .text-scroll-area {
        margin-top: 160px;
        max-height: calc(100vh - 170px);
    }
    .poem {
        padding: 20px;
        margin: 30px 0;
    }
    .citation-topright {
        right: 6px;
        top: 5px;
        font-size: 0.93em;
        padding: 3px 10px 3px 10px;
    }
    .text-counter {
        font-size: 0.97rem;
        margin-bottom: 10px;
    }
}
@media (max-width: 480px) {
    .title {
        font-size: 1.3rem;
        margin-top: 7px;
    }
    .author {
        margin-bottom: 5px;
    }
    .text-content {
        font-size: 14.7px;
        padding: 13px 3.7vw 18px 3.7vw;
    }
    .fixed-header {
        padding: 7px 0 3px 0;
    }
    .text-scroll-area {
        margin-top: 98px;
        max-height: calc(100vh - 118px);
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(40, 40, 60, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #ff8c00, #ff6347);
}

/* Selection styling */
::selection {
    background: rgba(255, 215, 0, 0.3);
    color: #ffffff;
}

* {
    transition: all 0.3s ease;
}