@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
    --primary: #4c1d95;
    /* Deep Purple */
    --primary-dark: #2e1065;
    --accent: #8b5cf6;
    /* Vibrant Purple */
    --accent-gold: #fbbf24;
    --text-main: #1e1b4b;
    /* Deep Indigo for text */
    --text-muted: #6b7280;
    --bg-light: #f5f3ff;
    /* Very Light Purple / Lavender */
    --bg-white: #ffffff;
    --manga-black: #111111;
    --accent-vibrant: #ef4444;
    --transition-comic: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --shadow-comic: 8px 8px 0px var(--manga-black);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.8;
    color: var(--text-main);
    background-color: var(--bg-light);
    background-image: radial-gradient(#ae98ff 2px, transparent 2px);
    /* Soft Purple Dots */
    background-size: 40px 40px;
    background-attachment: fixed;
}

/* Animations */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-smooth);
}

.fade-up.active {
    opacity: 1;
    transform: translateY(0);
}

/* Manga Screentone Patterns */
.screentone {
    background-image: radial-gradient(var(--manga-black) 10%, transparent 10%);
    background-size: 8px 8px;
    /* Dots */
    opacity: 0.05;
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.manga-border {
    border: 3px solid var(--manga-black);
    box-shadow: var(--shadow-comic);
}

@keyframes actionPop {
    0% {
        transform: scale(0.9) rotate(-2deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes mangaEntry {
    0% {
        opacity: 0;
        transform: scale(3) translateY(50px) rotate(10deg);
        filter: blur(10px);
    }

    70% {
        opacity: 1;
        transform: scale(0.9) translateY(-10px) rotate(-2deg);
        filter: blur(0);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotate(0);
        filter: blur(0);
    }
}

.manga-pop {
    animation: actionPop 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes darkenOverlay {
    0% {
        background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(76, 29, 149, 0.1) 100%);
    }

    100% {
        background: radial-gradient(circle at 50% 50%, rgba(46, 16, 101, 0.2) 20%, rgba(46, 16, 101, 0.7) 100%);
    }
}

.hero-delayed-entry {
    opacity: 0;
    animation: mangaEntry 1.0s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 4s;
}

.speech-bubble-container {
    position: relative;
    display: inline-block;
}

.bubble-bg {
    fill: white;
    stroke: var(--manga-black);
    stroke-width: 3;
}

/* Layout */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    z-index: 9997;
    border-bottom: 1px solid #e2e8f0;
}

.header__logo {
    text-align: center;
}

.header__logo a {
    display: block;
    width: 320px;
    margin: 15px auto;
}

.header__logo img {
    width: 100%;
    height: auto;
    display: block;
}

.header__nav {
    background: linear-gradient(165deg, rgb(74, 154, 198) 0%, rgb(28, 55, 94) 100%);
}

.header__lists {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.header__list a {
    display: block;
    padding: 10px 25px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.3s;
}

.header__list a:hover {
    opacity: 0.8;
}

.header-login a {
    background-color: #FED24E;
    color: #111111;
    border-radius: 3px;
    padding: 5px 30px;
    margin: 2px 20px;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-weight: 900;
}

.header-login a img {
    width: 13px;
    margin-right: 15px;
}

/* Page Layout Adjustment */
main {
    padding-top: 125px;
    /* Reduced to match actual header height */
}

/* Hero Section */
.hero {
    position: relative;
    height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    background-image: url('fv-banner.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #3b82f6;
    /* Fallback blue */
    overflow: hidden;
    margin-top: 0;
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

/* Character Styling (Fixed to screen sides) */
.side-character {
    position: fixed;
    bottom: -10px;
    height: 45vh;
    /* Adjusted height for viewport persistence */
    z-index: 1000;
    /* Stays on top of everything */
    pointer-events: none;
    filter: drop-shadow(10px 10px 0px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.character-man {
    right: 0;
    transform: translateX(10%);
}

.character-woman {
    left: 0;
    transform: translateX(-10%);
}

.char-entry-right {
    opacity: 0;
    animation: charPopRight 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 0.5s;
}

.char-entry-left {
    opacity: 0;
    animation: charPopLeft 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 0.8s;
}

@keyframes charPopRight {
    0% {
        transform: translateX(150px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(10%) scale(1);
        opacity: 1;
    }
}

@keyframes charPopLeft {
    0% {
        transform: translateX(-150px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateX(-10%) scale(1);
        opacity: 1;
    }
}

/* Anime Lens Flare */
.hero::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.4) 0%, transparent 10%),
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.2) 0%, transparent 20%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 40%);
    z-index: 1;
    pointer-events: none;
}

/* City Silhouette Layer */
.city-silhouette {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    z-index: 2;
    opacity: 0.3;
}

@keyframes cloudMove {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(200%);
    }
}

.cloud {
    position: absolute;
    opacity: 0.6;
    z-index: 1;
    animation: cloudMove 60s linear infinite;
    pointer-events: none;
}


.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.1) 100%);
    z-index: 1;
    animation: darkenOverlay 1.5s ease-in-out forwards;
    animation-delay: 4s;
}

.hero-content {
    position: relative;
    z-index: 10;
    /* Ensure content is above characters */
}

.hero h1 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.1rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.2);
}

.hero p {
    font-size: 1.6rem;
    font-weight: 500;
    opacity: 1;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

/* Story Section */
.story {
    background: #333;
    /* Darker charcoal */
    color: #fff;
    padding: 120px 0;
    text-align: center;
}

.story-text {
    font-size: 1.25rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 2;
    min-height: 12em;
    /* Prevent layout jump */
}

/* Explanation Cards */
.explanation {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    font-size: 2.25rem;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent);
    /* Now Purple */
}

.card {
    background: var(--bg-white);
    border: 3px solid var(--manga-black);
    padding: 60px 40px;
    border-radius: 4px;
    /* More angular for manga */
    box-shadow: var(--shadow-comic);
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
    transform: rotate(-0.5deg);
}

.card-accent-image {
    position: absolute;
    top: 10px;
    right: 80px;
    width: 150px;
    height: auto;
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(5px 5px 0px rgba(0, 0, 0, 0.1));
    animation: bounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bounceIn {
    0% {
        transform: scale(0) rotate(10deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.1) rotate(-5deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.card:nth-child(even) {
    transform: rotate(0.5deg);
}

.card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    z-index: 0;
}

.card h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
    font-size: 1.5rem;
}

/* Diagram */
.diagram-container {
    padding: 40px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 40px;
}

.diagram-item {
    text-align: center;
    width: 150px;
}

.box {
    background: var(--primary);
    color: white;
    padding: 20px;
    border-radius: 8px;
    font-weight: 500;
}

.arrow {
    font-size: 2rem;
    color: var(--accent);
    /* Now Purple */
}

/* Tabs */
.tabs-section {
    padding: 80px 0;
    background: var(--bg-white);
}

.tab-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.tab-btn {
    padding: 12px 30px;
    background: none;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    display: none;
}

.details-grid.active {
    display: grid;
}

.detail-item {
    padding: 20px;
    border-left: 4px solid var(--accent);
    /* Now Purple */
    background: var(--bg-light);
}

/* Summary */
.summary {
    padding: 120px 0;
    text-align: center;
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 20px 20px;
}

.highlight-box {
    border: 2px dashed var(--accent);
    /* Now Purple */
    padding: 40px;
    border-radius: 12px;
    display: inline-block;
}

.highlight-box h2 {
    color: #b91c1c;
    margin-bottom: 1rem;
}

/* Next Track */
.next-track {
    padding: 60px 0;
    background: var(--primary-dark);
    color: white;
    text-align: center;
}

.next-card {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    border-radius: 12px;
    display: inline-block;
    transition: var(--transition-smooth);
}

.next-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

footer {
    padding: 40px 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .header__logo a {
        width: 240px;
        margin: 10px auto;
    }

    .header__list a {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .header-login a {
        padding: 5px 15px;
        margin: 2px 10px;
    }

    main {
        padding-top: 115px;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .series-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header__logo a {
        width: 180px;
    }

    .header__lists {
        flex-wrap: wrap;
        padding: 5px 0;
    }

    .header__list a {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .header-login {
        display: none;
        /* Hide on small mobile to stay clean, or toggle via menu if added */
    }

    main {
        padding-top: 130px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .diagram-container {
        flex-direction: column;
        gap: 20px;
    }
}

/* Series Index Styles */
.series-section {
    padding: 100px 0;
    background: var(--bg-light);
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-top: 50px;
}

.series-card {
    background: var(--bg-white);
    text-decoration: none;
    color: inherit;
    transition: var(--transition-comic);
    display: flex;
    flex-direction: column;
    position: relative;
}

.series-card:hover {
    transform: translateY(-10px) rotate(1deg);
}

.series-card.latest-highlight {
    border: 4px solid #fbbf24;
    /* Gold border */
    box-shadow: 10px 10px 0px #111, 0 0 20px rgba(251, 191, 36, 0.4);
}

.series-image-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    margin-bottom: 20px;
    border: 3px solid var(--manga-black);
}

.series-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.series-card:hover .series-image-wrapper img {
    transform: scale(1.05);
}

.vol-tag {
    position: absolute;
    top: -10px;
    left: -10px;
    background: var(--accent-vibrant);
    color: white;
    padding: 5px 15px;
    font-weight: 900;
    font-size: 1.2rem;
    z-index: 10;
    border: 3px solid var(--manga-black);
    transform: rotate(-5deg);
    box-shadow: 4px 4px 0 var(--manga-black);
}

.new-badge {
    position: absolute;
    top: -20px;
    right: -20px;
    background: #ffec00;
    color: #111;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.9rem;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    z-index: 15;
    animation: pulseGlow 1.5s infinite;
    border: 2px solid #111;
}

@keyframes pulseGlow {
    0% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 0 0px rgba(255, 236, 0, 0);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
        box-shadow: 0 0 15px rgba(255, 236, 0, 0.8);
    }

    100% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 0 0px rgba(255, 236, 0, 0);
    }
}

.date-bubble {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: white;
    padding: 4px 12px;
    border: 2px solid var(--manga-black);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
}

.series-info {
    padding: 10px 5px;
}

.series-info h3 {
    font-weight: 900;
    font-size: 1.4rem;
    line-height: 1.4;
    margin-bottom: 5px;
    color: var(--manga-black);
}

.series-info .series-category {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@media (max-width: 1024px) {
    .series-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .series-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Screen */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff; /* White Theme */
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease, visibility 1s;
    overflow: hidden;
}

.loader-container.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.loader-map-wrapper {
    position: relative;
    margin-bottom: 30px;
}

.loader-map {
    width: 150px;
    height: auto;
    filter: grayscale(1) opacity(0.8);
    animation: mapPulseMinimal 2s ease-in-out infinite;
}

@keyframes mapPulseMinimal {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.loader-text {
    color: #111111;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
    letter-spacing: 0.1rem;
    margin-bottom: 20px;
}

.loader-bar-container {
    width: 200px;
    height: 2px;
    background: #f1f5f9;
    border-radius: 1px;
    margin: 0 auto;
    overflow: hidden;
}

.loader-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, #fbbf24, transparent);
    animation: barMove 1.5s linear infinite;
}

@keyframes barMove {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}