:root {
    --primary-red: #e50914;
    --dark-red: #580000;
    --primary-purple: #7e0cce;
    --dark-bg: #0a0a0a;
    --text-color: #f5f5f5;
    --gold: #d4af37;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Noto Serif JP', serif;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flicker {

    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        text-shadow: 0 0 5px var(--primary-red), 0 0 10px var(--primary-red), 0 0 20px #ff0000;
        color: #fff;
    }

    20%,
    24%,
    55% {
        text-shadow: none;
        color: #555;
    }
}

@keyframes burn-red {
    0% {
        box-shadow: 0 0 10px #f00, 0 -2px 20px #ff6b6b inset;
    }

    50% {
        box-shadow: 0 0 25px #f00, 0 -5px 30px #ff6b6b inset;
    }

    100% {
        box-shadow: 0 0 10px #f00, 0 -2px 20px #ff6b6b inset;
    }
}

@keyframes flame-move {
    0% {
        transform: scale(1) rotate(-2deg);
    }

    50% {
        transform: scale(1.05) rotate(2deg);
    }

    100% {
        transform: scale(1) rotate(-2deg);
    }
}

/* Base Styles */
.animate-fade-in-down {
    animation: fadeInDown 1.5s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 1.5s ease-out forwards 0.5s;
    opacity: 0;
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fire Overlay */
#fire-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    /* Flames on top/overlay */
    overflow: hidden;
}



/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent);
    z-index: 1000;
}

.header-flame {
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(to right, transparent, var(--primary-purple), transparent);
    border-image-slice: 1;
    box-shadow: 0 5px 15px rgba(126, 12, 206, 0.2);
}

.logo-small img {
    height: 50px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    margin-right: 40px;
}

nav a {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    transition: color 0.3s;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-red);
    transition: width 0.3s;
}

nav a:hover {
    color: var(--primary-red);
}

nav a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    /* justify-content: center; Removed to allow space-between in content */
    align-items: center;
    text-align: center;
    overflow: hidden;
}

.hero-content {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding-top: 80px;
    padding-bottom: 120px;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/main_visual.jpg');
    background-size: cover;
    background-position: center;
    z-index: -1;
    filter: brightness(0.6);
}

.main-logo {
    max-width: 50%;
    max-height: 25vh;
    margin-bottom: 0;
}

.catchphrase {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.5;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.8);
    font-family: 'Noto Serif JP', serif;
}

.text-fire {
    color: #ff5722;
    text-shadow: 0 0 10px #ff5722, 0 0 20px #ff0000;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    font-size: 12px;
    letter-spacing: 3px;
    writing-mode: vertical-rl;
    animation: fadeInUp 2s infinite;
}

/* Sections */
.section {
    padding: 100px 20px;
}

.section-title {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 60px;
    color: var(--gold);
    border-bottom: 2px solid var(--primary-red);
    display: inline-block;
    padding-bottom: 10px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Trailer Frame */
.trailer-frame {
    width: 30%;
    margin: 0 auto;
    padding: 20px;
    background: #000;
    position: relative;
    border: 10px solid transparent;
    border-image: linear-gradient(to bottom right, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c) 1;
    box-shadow:
        0 0 0 5px #000 inset,
        0 0 20px rgba(191, 149, 63, 0.5),
        0 10px 20px rgba(0, 0, 0, 0.8);
}

.trailer-frame::before,
.trailer-frame::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #bf953f, #fcf6ba);
    z-index: 2;
}

.trailer-frame::before {
    top: -5px;
    left: -5px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
}

.trailer-frame::after {
    bottom: -5px;
    right: -5px;
    box-shadow: -2px -2px 2px rgba(0, 0, 0, 0.5);
}

.trailer-frame video {
    width: 100%;
    display: block;
    box-shadow: inset 0 0 20px #000;
}

@media (max-width: 768px) {
    .trailer-frame {
        width: 80%;
    }
}

/* BGM Control */
.bgm-control {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, #ff4500, #800000);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 0 20px #ff4500, 0 0 40px #ff0000;
    animation: burn-red 1s infinite alternate, flame-move 2s infinite ease-in-out;
    transition: transform 0.3s;
}

.bgm-control:hover {
    transform: scale(1.1);
}

.bgm-control span {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
}

/* Topics */
.topic-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-left: 4px solid var(--primary-red);
    display: flex;
    align-items: center;
    gap: 20px;
}

.topic-item .date {
    font-family: 'Roboto', sans-serif;
    color: #888;
}

.topic-item .tag {
    background: var(--primary-red);
    color: #fff;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 2px;
}

/* Introduction */
.bg-dark-red {
    background: linear-gradient(135deg, #000 0%, var(--dark-red) 100%);
}

.intro-text {
    line-height: 2;
    font-size: 1.1rem;
    text-align: center;
}

.intro-text .lead {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-red);
    margin-bottom: 40px;
    font-family: 'Noto Serif JP', serif;
}

/* Story */
.box-layout {
    background: url('assets/main_visual.jpg') no-repeat center center/cover;
    position: relative;
    padding: 60px;
    border: 1px solid #333;
}

.box-layout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.story-content {
    position: relative;
    z-index: 1;
}

.story-content h3 {
    text-align: center;
    margin-bottom: 40px;
    color: #ccc;
}

.story-content p {
    margin-bottom: 20px;
    text-align: justify;
}

/* Characters */
.bg-purple {
    background: linear-gradient(to bottom, #000, #1a0029);
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.char-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    border-top: 4px solid transparent;
    transition: transform 0.3s, background 0.3s;
}

.char-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.1);
}

.char-card.fire {
    border-color: var(--primary-red);
    box-shadow: 0 0 10px rgba(229, 9, 20, 0.2);
}

.char-card.purple-fire {
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(126, 12, 206, 0.2);
}

.char-card.metal {
    border-color: #7f8c8d;
}

.char-card.speed {
    border-color: #f1c40f;
}

.char-card.barrier {
    border-color: #3498db;
}

.char-card h3 {
    margin-top: 0;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.char-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.char-body {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    /* Space between Char info and CV info */
    padding-bottom: 15px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    /* Subtle separator */
}

.char-face {
    width: 110px;
    /* Fixed width */
    height: 110px;
    /* Fixed height */
    object-fit: cover;
    /* Crop to fill */
    object-position: top center;
    /* Focus on face */
    flex-shrink: 0;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.char-card .desc {
    font-size: 0.95rem;
    line-height: 1.6;
}

.cv-info {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.cv-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.cv-comment {
    font-size: 0.8rem;
    color: #ccc;
    font-style: italic;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 4px;
    line-height: 1.4;
    position: relative;
    width: 100%;
}

.cv-comment::before {
    content: '“';
    position: absolute;
    top: -5px;
    left: -5px;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.1);
    font-family: serif;
}

.cv-name {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 20px;
    font-weight: bold;
    text-align: right;
}

/* Removed previous char-body/face/desc definitions to consolidate above */

/* Keyword */
.keyword-box {
    border: 1px solid var(--gold);
    padding: 40px;
    text-align: center;
    position: relative;
}

.keyword-box::after {
    content: 'KEYWORD';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-bg);
    padding: 0 20px;
    color: var(--gold);
    font-weight: bold;
}

/* Footer */
footer {
    padding: 60px 20px;
    text-align: center;
    background: #000;
    border-top: 1px solid #333;
    font-size: 0.8rem;
    color: #666;
}

footer .credits {
    margin-bottom: 30px;
}

footer .credits p {
    margin: 5px 0;
}

/* 2. Rising Sparks (Hi-no-ko) - Re-added */
.spark {
    position: absolute;
    bottom: -10px;
    /* Start slightly below */
    background: #fff;
    border-radius: 50%;
    mix-blend-mode: screen;
    pointer-events: none;
    opacity: 0;
    z-index: 101;
    /* Above flames */
}

.spark-red {
    background: radial-gradient(circle, #ffe600, #ff4500);
    box-shadow: 0 0 5px #ff4500;
}

.spark-purple {
    background: radial-gradient(circle, #e0b0ff, #800080);
    box-shadow: 0 0 5px #800080;
}

@keyframes riseSpark {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
        transform: translateY(-90vh) scale(0.5);
        /* Fly up high */
    }
}