:root {
    --font-heading: 'Cinzel', serif;
    --font-body: 'Noto Serif JP', serif;
    --color-text: #5f544b;
    --color-border: #e6e2da;
    --color-accent: #a15c4a;
    --card-width: 400px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-user-select: none; user-select: none; }
html { scroll-behavior: smooth; }
*:focus { outline: none; }
a, button { -webkit-tap-highlight-color: transparent; }

#loader { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: #ffffff; z-index: 9999; display: flex; justify-content: center; align-items: center; transition: opacity 0.7s ease, visibility 0.7s; }
#loader.hidden { opacity: 0; visibility: hidden; }
#loader img { width: 80px; animation: pulse 1.5s ease-in-out infinite; }

body { color: var(--color-text); font-family: var(--font-body); font-size: 15px; line-height: 1.8; overflow-x: hidden; background-color: #1a1a1a; }
#page-background { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-image: url('/images/page-bg.webp'); background-size: cover; background-position: center; z-index: -2; }

.top-left-header { position: fixed; top: 0; left: 0; z-index: 100; padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.top-left-header .header-logo { height: 35px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.top-left-header h1 { font-family: var(--font-heading); color: white; font-size: 1.2rem; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

.main-nav { position: fixed; top: 0; right: 0; padding: 1rem 1.5rem; z-index: 100; }
.main-nav ul { list-style: none; display: flex; gap: 1.5rem; background: rgba(26, 26, 26, 0.5); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); padding: 0.5rem 1rem; border-radius: 4px; border: 1px solid rgba(230, 226, 218, 0.2); }
.main-nav a { text-decoration: none; color: #fff; font-family: var(--font-heading); font-size: 0.9rem; transition: color 0.3s; }
.main-nav a:hover, .main-nav li.active a { color: #f0c5a8; }

.hamburger-btn { display: none; position: fixed; top: 1rem; right: 1rem; z-index: 1002; width: 40px; height: 40px; background: transparent; border: none; cursor: pointer; }
.hamburger-btn span { display: block; width: 24px; height: 2px; background-color: white; margin: 5px auto; transition: all 0.3s ease-in-out; }
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav-panel { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 1001; display: flex; align-items: center; justify-content: center; transform: translateX(100%); visibility: hidden; transition: transform 0.4s ease, visibility 0.4s; }
.mobile-nav-panel.open { transform: translateX(0); visibility: visible; }
.mobile-nav-panel ul { list-style: none; text-align: center; }
.mobile-nav-panel li { margin: 2rem 0; }
.mobile-nav-panel a { text-decoration: none; color: #fff; font-family: var(--font-heading); font-size: 1.5rem; }

.hero { position: relative; height: 45vh; min-height: 350px; display: flex; justify-content: center; margin-bottom: -50px; margin-top: 80px; }
.character-image { position: absolute; bottom: 0; max-height: 100%; height: auto; width: auto; max-width: 100%; filter: drop-shadow(0 5px 15px rgba(0,0,0,0.4)); opacity: 0; animation: slideUpFadeIn 1.5s 0.5s ease-out forwards; }

.container { max-width: 900px; margin: 0 auto; padding: 1rem; }
.card { background: url('/images/common-bg.jpg'); border: 1px solid var(--color-border); border-radius: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); margin: 0 auto 2.5rem; max-width: 650px; }
.logo-container { text-align: center; padding: 2rem 0 1rem; }
.series-logo { max-width: 220px; width: 60%; }

#about-me { margin-top: 2.5rem; }

.marquee-scroller { width: 100%; overflow: hidden; padding: 2.5rem 0; -webkit-mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent); mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent); }
.marquee-track { display: flex; width: fit-content; animation-play-state: paused; }
.marquee-scroller.visible .marquee-track { animation-play-state: running; }
.marquee-scroller[data-direction="right"] .marquee-track { animation: scroll-right 80s linear infinite; }
.marquee-scroller[data-direction="left"] .marquee-track { animation: scroll-left 80s linear infinite; }
.marquee-item { flex-shrink: 0; width: 100px; height: 100px; margin: 0 10px; }
.marquee-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; outline: 2px solid white; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

.profile-section { position: relative; padding: 2rem; overflow: hidden; }
.profile-elaina-img { position: absolute; pointer-events: none; right: -40px; bottom: -20px; width: 200px; opacity: 0.9; }
.section-title-alt { position: relative; font-family: var(--font-heading); font-size: 1.8rem; margin-bottom: 2rem; padding-bottom: 0.5rem; }
.section-title-alt::after { content: ''; position: absolute; bottom: 0; left: 0; width: 60px; height: 2px; background-color: var(--color-accent); }
.section-title-alt.centered { text-align: center; }
.section-title-alt.centered::after { left: 50%; transform: translateX(-50%); }
.profile-content { position: relative; z-index: 1; text-align: left; max-width: 400px; }
.profile-about { font-size: 0.95rem; margin-bottom: 1.5rem; }
.personal-info { list-style: none; font-size: 0.9rem; color: var(--color-text); }
.personal-info li { margin-bottom: 0.5rem; display: flex; align-items: center; }
.personal-info .symbol { margin-right: 0.75em; color: var(--color-accent); font-size: 1.2em; }

.timeline-section { padding: 2rem 1rem; }
.timeline-container-v2 { display: flex; gap: 2rem; max-width: 550px; margin: 2rem auto 0; }
.timeline-path { flex: 0 0 20px; position: relative; }
.timeline-line { position: absolute; top: 20px; bottom: 20px; left: 50%; transform: translateX(-50%); width: 2px; background-color: var(--color-border); }
.timeline-marker { position: absolute; top: 0; left: 50%; transform: translate(-50%, 0); font-size: 1.8rem; color: var(--color-accent); transition: transform 0.4s ease-in-out; }
.timeline-events { flex: 1; display: flex; flex-direction: column; }
.timeline-item-v2 { padding: 1.25rem 1.5rem; margin-bottom: 2.5rem; border-left: 3px solid var(--color-border); transition: border-color 0.4s ease; position: relative; }
.timeline-item-v2.active { border-left-color: var(--color-accent); }
.timeline-item-v2::before { content: ''; position: absolute; left: -10px; top: 24px; width: 16px; height: 16px; background-color: white; border: 3px solid var(--color-border); border-radius: 50%; transition: border-color 0.4s ease; }
.timeline-item-v2.active::before { border-color: var(--color-accent); }
.timeline-item-year { font-size: 0.8rem; font-weight: bold; color: var(--color-accent); margin-bottom: 0.5rem; }
.timeline-item-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; font-family: var(--font-heading); }
.timeline-item-description { font-size: 0.9rem; }

.elaina-profile-section { max-width: 650px; overflow: hidden; }
.elaina-profile-card { display: flex; flex-direction: column; }
.elaina-profile-img-container { text-align: center; }
.elaina-profile-img-container img { max-width: 100%; height: auto; }
.elaina-profile-details { padding: 0 2rem 2rem; }
.elaina-cv { font-size: 0.9rem; } .elaina-cv span { font-size: 0.8rem; }
.elaina-name { font-size: 1.5rem; font-weight: bold; margin-bottom: 0.5rem; }
.elaina-description { font-size: 0.9rem; }

.section-title-wrapper { text-align: center; margin-bottom: 1.5rem; }
.section-title-image { max-width: 250px; }

.story-carousel-wrapper { overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: calc(50% - var(--card-width) / 2); -webkit-overflow-scrolling: touch; }
.story-carousel-wrapper::-webkit-scrollbar { height: 8px; }
.story-carousel-wrapper::-webkit-scrollbar-track { background: #f0ede6; }
.story-carousel-wrapper::-webkit-scrollbar-thumb { background: #d3c9ba; border-radius: 4px; }
.story-carousel-track { display: flex; gap: 20px; padding-left: calc(50% - var(--card-width) / 2); padding-right: calc(50% - var(--card-width) / 2); }
.story-card { flex: 0 0 var(--card-width); scroll-snap-align: center; background: url('/images/common-bg.jpg'); border: 1px solid var(--color-border); border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); padding: 1.5rem; }

.ep-title { margin-bottom: 1rem; } .ep-label { font-size: 1rem; } .ep-main-title { font-size: 1rem; font-weight: 700; }
.ep-gallery { position: relative; width: 100%; margin: 0 auto 1.5rem auto; border-radius: 4px; }
.ep-gallery-track-container { overflow: hidden; cursor: grab; } .ep-gallery-track-container.grabbing { cursor: grabbing; }
.ep-gallery-track { display: flex; } .ep-gallery-slide { flex: 0 0 100%; }
.ep-gallery-slide img { width: 100%; display: block; user-select: none; pointer-events: none; border-radius: 4px; outline: 2px solid white; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.ep-gallery-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 10; }
.ep-gallery-dots .dot { width: 8px; height: 8px; background-color: rgba(255, 255, 255, 0.6); border: 1px solid rgba(0,0,0,0.2); cursor: pointer; transition: background-color 0.3s; transform: rotate(45deg); }
.ep-gallery-dots .dot.active { background-color: white; }
.ep-gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0,0,0,0.4); color: white; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 1.5rem; cursor: pointer; transition: background-color 0.2s; user-select: none; z-index: 10; display: flex; align-items: center; justify-content: center; }
.ep-gallery-arrow:hover { background-color: rgba(0,0,0,0.6); }
.ep-gallery-arrow.prev { left: 10px; } 
.ep-gallery-arrow.next { right: 10px; }
.ep-details { font-size: 0.9rem; text-align: left; } .ep-synopsis { margin-bottom: 1rem; }
.ep-staff { font-size: 0.8rem; color: #aaa; margin-top: 1.5rem; }

.visual-gallery-section { padding: 1.5rem; }
.visual-gallery-section .section-title-alt { margin-bottom: 1.5rem; }
.visual-main-container { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-bottom: 1.5rem; border-radius: 4px; overflow: hidden; background: #f0ede6; }
.visual-main-item { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.5s ease-in-out; }
.visual-main-item.active { opacity: 1; z-index: 1; }
.visual-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.visual-main-item.active .visual-bg { animation: ken-burns 20s ease-out infinite alternate; }
.visual-char { position: absolute; bottom: 0; max-height: 95%; max-width: 90%; height: auto; z-index: 2; pointer-events: none; opacity: 0; transform: translateY(30px) translateX(-50%); }
.visual-main-item.active .visual-char { animation: slideUpChar 1s 0.2s ease-out forwards; }
.visual-char:first-of-type { left: 50%; }
.visual-char:last-of-type:not(:first-of-type) { left: 60%; }
.visual-char:first-of-type:not(:last-of-type) { left: 40%; }
.visual-thumbnails { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.visual-thumb { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; cursor: pointer; border: 2px solid var(--color-border); transition: transform 0.2s ease, border-color 0.2s ease; }
.visual-thumb:hover { transform: scale(1.1); }
.visual-thumb.active { border-color: var(--color-accent); transform: scale(1.1); }

.comments-section { padding: 2rem; }
.comment-box { height: 350px; overflow-y: auto; margin-bottom: 1.5rem; border: 1px solid var(--color-border); border-radius: 4px; padding: 1rem; background: rgba(255,255,255,0.5); }
.comment-list { display: flex; flex-direction: column; gap: 1rem; }
.comment-bubble { position: relative; background: #fff; border-radius: 8px; padding: 0.75rem 1rem 1.7rem 1rem; max-width: 85%; align-self: flex-start; box-shadow: 0 2px 5px rgba(0,0,0,0.05); animation: slideUpBubble 0.5s ease-out forwards; }
.comment-header { margin-bottom: 0.25rem; }
.comment-name { font-weight: 700; color: var(--color-accent); font-size: 0.9rem; }
.comment-time { position: absolute; bottom: 0.5rem; right: 1rem; font-size: 0.7rem; color: #aaa; }
.comment-message { line-height: 1.5; font-size: 0.95rem; word-wrap: break-word; }
.comment-form { display: flex; gap: 0.5rem; }
.comment-form input { flex-grow: 1; border: 1px solid var(--color-border); background: rgba(255,255,255,0.7); padding: 0.75rem; border-radius: 4px; color: var(--color-text); font-family: var(--font-body); }
.comment-form input::placeholder { color: #999; }
.comment-form button { background-color: var(--color-accent); color: white; border: none; border-radius: 4px; width: 45px; height: 45px; cursor: pointer; transition: background-color 0.2s; }
.comment-form button:hover { background-color: #8a4e3e; }
.comment-form button:disabled { background-color: #ccc; cursor: not-allowed; }

.contact-section { padding: 0; border: none; background: transparent; box-shadow: none; }
.contact-header { text-align: center; margin-bottom: 2rem; }
.contact-pfp { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--color-border); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.contact-name { font-family: var(--font-heading); font-size: 1.5rem; margin-top: 1rem; margin-bottom: 0.25rem; }
.contact-nickname { font-size: 1rem; color: #888; margin-bottom: 2rem; }
.contact-links { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.contact-link-item { background: rgba(255,255,255,0.6); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.75rem 1.25rem; display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--color-text); transition: background-color 0.3s, box-shadow 0.3s; }
.contact-link-item:hover { background-color: rgba(255,255,255,0.9); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.contact-link-item svg { width: 20px; height: 20px; color: var(--color-accent); }
.contact-link-item span { font-weight: 600; }

.scroll-fade { opacity: 0; transform: translateY(40px); transition: opacity 0.8s ease-out, transform 0.6s ease-out; }
.scroll-fade.visible { opacity: 1; transform: translateY(0); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes slideUpFadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ken-burns { 0% { transform: scale(1.05) translate(0, 0); } 100% { transform: scale(1.15) translate(-2%, 2%); } }
@keyframes slideUpChar { from { opacity: 0; transform: translateY(30px) translateX(-50%); } to { opacity: 1; transform: translateY(0) translateX(-50%); } }
@keyframes slideUpBubble { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scroll-left { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes scroll-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

@media (max-width: 768px) { 
    .timeline-container-v2 { gap: 1rem; } 
    .main-nav { display: none; }
    .hamburger-btn { display: block; }
    .hero { margin-top: 60px; }
    .top-left-header { display: flex; }
}

@media (max-width: 450px) { :root { --card-width: 90vw; } }

@media (min-width: 601px) {
    .elaina-profile-card { flex-direction: row; align-items: center; }
    .elaina-profile-img-container { flex: 0 0 40%; }
    .elaina-profile-details { flex: 1; padding: 2rem; }
}
