:root {
    --bg-color: #f0ede6;
    --text-color: #1a1a1a;
    --accent-red: #8b0000;
    --accent-blue: #001f3f;
    --font-main: 'Shippori Mincho', 'Noto Serif JP', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: none !important;
}

img {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

body {
    background-color: var(--bg-color);
    background-image: url('assets/background.png');
    background-size: 100%;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
}

/* Custom Cursor */
.custom-cursor {
    width: 120px;
    height: 120px;
    background-image: url('assets/arrow.png');
    background-size: contain;
    background-repeat: no-repeat;
    position: fixed;
    pointer-events: none;
    z-index: 40000;
    transform: translate(0%, -100%) rotate(0deg);
    transition: transform 0.1s ease-out;
}

.custom-cursor.hover {
    transform: translate(0%, -100%) rotate(0deg) scale(1.2);
    filter: drop-shadow(0 0 5px var(--accent-red));
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.main-logo {
    width: 90vw;
    max-width: 800px;
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.6));
    animation: logoFadeIn 2s ease-out forwards;
}

.pv-link-btn {
    display: inline-block;
    padding: 25px 80px;
    border: 2px solid var(--accent-red);
    color: var(--accent-red);
    text-decoration: none;
    font-size: 1.4rem;
    letter-spacing: 0.3em;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    animation: buttonFadeIn 2.5s ease-out forwards;
}

.pv-link-btn:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
}

@keyframes buttonFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Common Section Styles */
section {
    padding: 200px 20px 150px;
    max-width: 1000px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: all 1s ease-out;
}

section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 60px;
    letter-spacing: 0.2em;
    position: relative;
    color: var(--accent-red);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background-color: var(--accent-red);
}

.story-scroll-indicator {
    text-align: center;
    color: var(--accent-red);
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    margin-bottom: 20px;
    opacity: 0.8;
    animation: pulseArrow 1.5s infinite;
}

@keyframes pulseArrow {

    0%,
    100% {
        transform: translateX(0);
        opacity: 0.8;
    }

    50% {
        transform: translateX(-5px);
        opacity: 0.4;
    }
}

/* Story Section */
.story-text-container {
    max-width: 100%;
    margin: 60px auto;
    font-size: 1.1rem;
    letter-spacing: 0.3em;
    line-height: 4.1;
    height: 105vh;
    writing-mode: vertical-rl;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 40px 100px 40px 40px;
    text-align: left;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-red) transparent;
    cursor: grab;
}

.story-text-container:active {
    cursor: grabbing;
}

.story-text-container::-webkit-scrollbar {
    height: 4px;
}

.story-text-container::-webkit-scrollbar-thumb {
    background: var(--accent-red);
    border-radius: 10px;
}

.story-text-container p {
    margin-bottom: 0.8em;
}

.story-accent {
    font-size: 1.1rem;
    color: var(--accent-blue);
    font-weight: bold;
}

.highlight-red {
    color: var(--accent-red);
    font-size: 1.3rem;
    font-weight: bold;
    display: block;
    margin: 20px 0;
}

.highlight-large {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 0 5px;
}

.footer-message {
    font-size: 2.5rem;
    color: var(--accent-red);
    margin-top: 60px;
    margin-right: 80px;
    letter-spacing: 0.4em;
    font-weight: bold;
    opacity: 0;
    line-height: 2.5;
}

.footer-message.animate {
    animation: shockGlitch 0.6s cubic-bezier(.25, .46, .45, .94) both;
}

@keyframes shockGlitch {
    0% {
        transform: scale(1.05);
        opacity: 0;
        filter: blur(20px) contrast(300%);
    }

    20% {
        opacity: 0.2;
        filter: blur(15px) contrast(200%);
        transform: translateX(2px);
    }

    40% {
        opacity: 0.4;
        filter: blur(10px) contrast(150%);
        transform: translateX(-2px);
    }

    60% {
        opacity: 0.7;
        filter: blur(5px) contrast(120%);
        transform: translateX(1px);
        text-shadow: 0 0 10px var(--accent-red);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
        text-shadow: 0 0 20px rgba(139, 0, 0, 0.4);
    }
}

/* Character Card */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 60px;
}

.character-quote-text {
    text-align: center;
    font-size: 2rem;
    color: var(--accent-red);
    letter-spacing: 0.15em;
    line-height: 2;
    font-weight: bold;
    margin-top: 150px;
    margin-bottom: 20px;
    animation: eerieGlow 4s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

@keyframes eerieGlow {

    0%,
    100% {
        opacity: 0.8;
        filter: blur(0px);
        transform: scale(1);
    }

    50% {
        opacity: 1;
        filter: blur(0.3px);
        transform: scale(1.01);
        text-shadow: 0 0 15px rgba(139, 0, 0, 0.6), 0 0 30px rgba(139, 0, 0, 0.3);
    }
}

.hashtag {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-red);
    margin-bottom: 30px;
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
    display: inline-block;
    user-select: none;
    pointer-events: none;
}

.hashtag:hover {
    animation: hashtagFlicker 0.1s infinite;
}

@keyframes hashtagFlicker {
    0% {
        color: var(--accent-red);
        text-shadow: 2px 0 0 black;
    }

    50% {
        color: black;
        text-shadow: -2px 0 0 var(--accent-red);
    }

    100% {
        color: var(--accent-red);
        text-shadow: 2px 0 0 black;
    }
}

.purchase-section {
    text-align: center;
    padding: 200px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.purchase-btn {
    display: inline-block;
    padding: 25px 60px;
    border: 2px solid var(--accent-red);
    color: var(--accent-red);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.purchase-btn:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.6);
}

.spec-section {
    padding: 0 20px 100px;
    margin-top: 150px;
    text-align: center;
}

.spec-list {
    display: inline-block;
    text-align: left;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

.spec-item {
    display: flex;
    border-bottom: 1px solid rgba(139, 0, 0, 0.3);
    padding: 15px 0;
}

.spec-item dt {
    width: 180px;
    font-weight: bold;
    color: var(--accent-red);
    flex-shrink: 0;
}

.spec-item dd {
    flex-grow: 1;
    color: var(--text-color);
    font-weight: bold;
}

.character-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 0, 0, 0.3);
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer !important;
}

.character-card:hover {
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.2);
}

.char-info {
    margin-top: 20px;
}

.char-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-blue);
}

.char-image {
    height: 280px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    filter: grayscale(1);
    transition: filter 0.5s ease;
    border-bottom: 1px solid rgba(139, 0, 0, 0.1);
    margin-bottom: 15px;
}

.character-card:hover .char-image {
    filter: grayscale(0);
}

.char-image img {
    width: 180%;
    height: auto;
    object-fit: contain;
    object-position: top center;
}

/* Adjust Kan and Aegis image sizes to match Iri and Amari */
.character-card:nth-child(1) .char-image img {
    width: 150%;
    object-position: 65% top;
    transform: translateX(-10px);
}

.character-card:nth-child(3) .char-image img {
    width: 150%;
}

/* Adjust Iri image size */
.character-card:nth-child(2) .char-image img {
    width: 165%;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 20px;
    background: rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 5;
}

footer p {
    color: var(--accent-red);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.2em;
}

.footer-logo-link {
    display: inline-block;
    position: relative;
    padding: 30px 50px;
}

.footer-logo {
    max-width: 400px;
    height: auto;
    transition: filter 0.1s ease;
}

.footer-logo-link:hover .footer-logo {
    animation: noiseGlitch 0.3s infinite;
}

@keyframes noiseGlitch {
    0% {
        filter: brightness(1) contrast(1);
        transform: translate(0, 0);
    }

    20% {
        filter: brightness(1.2) contrast(1.5) hue-rotate(90deg);
        transform: translate(-2px, 1px);
    }

    40% {
        filter: brightness(0.8) contrast(1.2) hue-rotate(-90deg);
        transform: translate(2px, -1px);
    }

    60% {
        filter: brightness(1.3) contrast(1.4) saturate(1.5);
        transform: translate(-1px, -1px);
    }

    80% {
        filter: brightness(0.9) contrast(1.3) hue-rotate(180deg);
        transform: translate(1px, 2px);
    }

    100% {
        filter: brightness(1) contrast(1);
        transform: translate(0, 0);
    }
}

/* Floating Button */
.floating-btn {
    position: fixed;
    top: 40px;
    right: 40px;
    padding: 12px 25px;
    border: 2px solid var(--accent-red);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: var(--accent-red);
    text-decoration: none;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    z-index: 35000;
    transition: all 0.3s ease;
}

.floating-btn:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.6);
}

/* Character Detail Overlay */
.char-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    z-index: 15000;
    display: flex;
    visibility: hidden;
    pointer-events: none;
    align-items: center;
    justify-content: flex-start;
    opacity: 0;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.char-overlay.active {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

.char-side-panel {
    width: 25%;
    height: 100%;
    background: rgba(0, 0, 0, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Changed to top-align */
    z-index: 2;
    position: relative;
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.2, 0, 0.2, 1);
    box-shadow: 10px 0 60px rgba(0, 0, 0, 0.9);
    padding: 100px 20px;
    /* Increased top padding for top-alignment */
}

.char-overlay.active .char-side-panel {
    transform: translateX(0);
}

.char-detail-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centers the vertical wrap block within the side panel */
    width: 100%;
    height: auto;
}

.char-vertical-wrap {
    display: block;
    /* Ensures name and quote are in the same vertical column in writing-mode: vertical-rl */
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: white;
    letter-spacing: 0.25em;
    height: auto;
    max-height: 80vh;
}

.char-flex-column {
    display: flex;
    flex-direction: column;
    /* In vertical-rl, column-direction stacks items on the same vertical line */
    align-items: flex-start;
    /* Top-aligns the name and quote */
    gap: 30px;
    /* Space between name and quote */
    width: 100%;
}

.char-detail-name {
    font-size: 5rem;
    /* Increased size for more impact */
    font-weight: bold;
    color: var(--accent-red);
    margin-bottom: 60px;
    /* More breathing room after large name */
    letter-spacing: 0.3em;
    display: block;
}

.char-quote {
    font-size: 1.1rem;
    line-height: 2.2;
    color: rgba(255, 255, 255, 0.85);
    white-space: pre-line;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    transition: opacity 0.5s ease;
    display: block;
    opacity: 0;
}

/* Image Container: Slid in from the Left */
.char-detail-img-container {
    position: absolute;
    top: 50%;
    left: 42%;
    width: 50%;
    height: 95%;
    pointer-events: none;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
}

.char-detail-img {
    height: 100%;
    width: auto;
    object-fit: contain;
    object-position: bottom center;
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.2, 0, 0.2, 1), opacity 0.8s ease;
}

.char-detail-img.slide-left {
    transform: translateX(-180px);
}

.char-detail-img.slide-right {
    transform: translateX(180px);
}

.char-overlay.active .char-detail-img {
    transform: translateX(0);
    opacity: 1;
}

.close-overlay {
    display: none;
    position: absolute;
    top: 40px;
    left: 40px;
    color: white;
    font-size: 3.5rem;
    cursor: pointer;
    z-index: 20000;
    transition: transform 0.3s ease;
    padding: 10px;
}

.close-overlay:hover {
    transform: scale(1.2) rotate(90deg);
    color: var(--accent-red);
}

.char-detail-ho {
    font-size: 1.5rem;
    color: white;
    margin-bottom: 20px;
    letter-spacing: 0.2em;
    font-weight: normal;
    opacity: 0.8;
}

@media (max-width: 1024px) {
    .char-side-panel {
        width: 50%;
    }
}

@media (max-width: 768px) {
    body {
        background-size: 250% auto;
        background-position: center 20%;
        overflow-x: hidden;
    }

    html {
        overflow-x: hidden;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 40px;
    }

    .character-quote-text {
        font-size: 1.2rem;
        margin-top: 80px;
        padding: 0 15px;
    }

    .floating-btn {
        top: 20px;
        right: 20px;
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .char-side-panel {
        width: 100%;
        padding: 60px 20px;
    }

    .char-detail-name {
        font-size: 3.5rem;
        margin-bottom: 30px;
    }

    .char-quote {
        font-size: 1.1rem;
        white-space: pre-line;
        writing-mode: horizontal-tb;
        text-align: center;
    }

    .char-vertical-wrap {
        writing-mode: horizontal-tb;
    }

    .char-flex-column {
        align-items: center;
        text-align: center;
    }

    .char-detail-ho {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .char-detail-img-container {
        display: none;
    }

    .spec-item dt {
        width: 150px;
        font-size: 0.9rem;
    }

    .spec-item dd {
        font-size: 0.9rem;
    }

    footer {
        padding: 40px 20px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .footer-logo {
        max-width: 250px;
    }

    .footer-logo-link {
        padding: 0;
    }
}