/* ╔═══════════════════════════════════════════════╗
   ║  BREAKING BAD UNIVERSE ENCYCLOPEDIA — CSS     ║
   ║  Palette: Heisenberg Dark / Crystal Blue /    ║
   ║  Hazmat Yellow / Lab Green / Desert Sand      ║
   ╚═══════════════════════════════════════════════╝ */

/* ───── ROOT VARIABLES ───── */
:root {
    --bg-dark: #121212;
    --bg-card: #1a1a1a;
    --accent-blue: #00BFFF;
    --accent-yellow: #D4AF37;
    --border-green: #2E8B57;
    --text-white: #F5F5F5;
    --text-sand: #EEDC9A;
    --font-heading: 'Bebas Neue', 'Courier Prime', sans-serif;
    --font-body: 'Roboto Mono', monospace;
    --glow-blue: 0 0 20px rgba(0, 191, 255, 0.5);
    --glow-green: 0 0 15px rgba(46, 139, 87, 0.6);
}

/* ───── RESET ───── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ───── TEXTURE OVERLAYS ───── */

/* Film grain */
.film-grain {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: 0.5;
    mix-blend-mode: overlay;
}

/* Graph-paper grid */
.graph-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(46, 139, 87, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(46, 139, 87, 0.06) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 1;
}

/* Smoke canvas */
#smoke-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

/* ───── AMBIENT SMOKE PARTICLES ───── */
.ambient-smoke {
    position: absolute;
    bottom: -50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 191, 255, 0.08) 0%, transparent 70%);
    animation: smokeDrift linear forwards;
    pointer-events: none;
}

@keyframes smokeDrift {
    0% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 0;
    }

    15% {
        opacity: 0.12;
    }

    100% {
        transform: translateY(-110vh) scale(2.5) rotate(180deg);
        opacity: 0;
    }
}

/* Hover smoke (on periodic elements) */
.hover-smoke {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 191, 255, 0.25), transparent 70%);
    pointer-events: none;
    animation: hoverSmokePop ease-out forwards;
    z-index: 3;
}

@keyframes hoverSmokePop {
    0% {
        transform: scale(0.3);
        opacity: 0.6;
    }

    100% {
        transform: scale(2) translateY(-30px);
        opacity: 0;
    }
}

/* ───── PAGE WRAPPER ───── */
.page-wrapper {
    position: relative;
    z-index: 5;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ═══════════════════════════════════════════
   HERO SECTION
   ═══════════════════════════════════════════ */

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    position: relative;
}

.hero-logo {
    width: clamp(150px, 30vw, 320px);
    margin-bottom: 2rem;
    animation: fadeInDown 1s ease-out;
}

.logo-img {
    width: 100%;
    filter: drop-shadow(0 0 25px rgba(0, 191, 255, 0.3));
    transition: filter 0.4s;
}

.logo-img:hover {
    filter: drop-shadow(0 0 40px rgba(0, 191, 255, 0.6));
}

/* ─── Element Boxes (Br / Ba / Section Titles) ─── */
.el-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1e5a3a, #2E8B57);
    border: 2px solid var(--border-green);
    padding: 0.15em 0.3em;
    margin: 0 0.05em;
    position: relative;
    vertical-align: baseline;
    line-height: 1;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.el-box .el-num {
    font-size: 0.3em;
    font-family: var(--font-body);
    position: absolute;
    top: 3px;
    right: 5px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.el-box .el-sym {
    font-family: var(--font-heading);
    font-size: 1em;
    color: var(--text-white);
}

.el-box.sm {
    padding: 0.1em 0.2em;
    font-size: 0.7em;
}

.el-box.sm .el-num {
    font-size: 0.35em;
    top: 2px;
    right: 3px;
}

.el-box.sm .el-sym {
    font-size: 1.1em;
}

.el-box.xs {
    padding: 0.05em 0.15em;
    font-size: 0.6em;
}

.el-box.xs .el-num {
    font-size: 0.35em;
    top: 1px;
    right: 2px;
}

.el-box.xs .el-sym {
    font-size: 1em;
}

/* ─── Hero Title ─── */
.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 4px;
    color: var(--text-white);
    animation: fadeInUp 1s 0.3s ease-out both;
    text-shadow: 0 0 30px rgba(0, 191, 255, 0.15);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.7rem, 1.5vw, 1rem);
    letter-spacing: 6px;
    color: var(--accent-blue);
    margin-top: 1rem;
    text-transform: uppercase;
    animation: fadeInUp 1s 0.6s ease-out both;
}

.hero-line {
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-green), transparent);
    margin: 1.5rem auto;
    animation: fadeInUp 1s 0.8s ease-out both;
}

.hero-tagline {
    font-family: 'Courier Prime', var(--font-body);
    font-style: italic;
    color: var(--text-sand);
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    opacity: 0.7;
    animation: fadeInUp 1s 1s ease-out both;
}

/* ═══════════════════════════════════════════
   SECTION COMMON
   ═══════════════════════════════════════════ */

section {
    padding: 5rem 0;
}

.section-heading {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-white);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.section-desc {
    text-align: center;
    color: var(--text-sand);
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.6s 0.15s ease-out;
}

.section-heading.visible,
.section-desc.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ═══════════════════════════════════════════
   PERIODIC TABLE NAVIGATION
   ═══════════════════════════════════════════ */

.periodic-table {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
}

/* ─── Base Element Cell ─── */
.el {
    aspect-ratio: 1;
    border: 2px solid var(--border-green);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.el .el-n {
    font-size: 0.65rem;
    position: absolute;
    top: 5px;
    right: 6px;
    color: rgba(255, 255, 255, 0.5);
}

.el .el-s {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    line-height: 1;
    color: var(--text-white);
}

.el .el-name {
    font-size: 0.5rem;
    color: var(--text-sand);
    opacity: 0.6;
    margin-top: auto;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
}

/* ─── Ghost (Decorative) Elements ─── */
.el.ghost {
    border-style: dashed;
    border-color: rgba(46, 139, 87, 0.25);
    background: rgba(18, 18, 18, 0.4);
    opacity: 0.35;
    pointer-events: none;
}

/* ─── Active (Interactive) Elements ─── */
.el.active-el {
    border-color: var(--border-green);
    cursor: pointer;
    background: linear-gradient(145deg, #141414, #1e1e1e);
}

.el.active-el .el-s {
    z-index: 3;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.9);
    transition: all 0.3s;
}

.el.active-el .el-n,
.el.active-el .el-name {
    z-index: 3;
}

.el.active-el .el-cat {
    font-size: 0.5rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 3;
    opacity: 0;
    transform: translateY(5px);
    transition: all 0.3s;
    margin-top: 2px;
}

/* BG Image */
.el-bg-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(1) contrast(1.1) brightness(0.5);
    opacity: 0;
    transition: opacity 0.4s, filter 0.4s;
    z-index: 1;
}

/* ─── Hover ─── */
.el.active-el:hover {
    transform: scale(1.12);
    border-color: var(--accent-blue);
    box-shadow: var(--glow-green), 0 0 30px rgba(0, 191, 255, 0.15);
    z-index: 20;
}

.el.active-el:hover .el-bg-img {
    opacity: 0.7;
    filter: grayscale(0.6) contrast(1.2) brightness(0.45);
}

.el.active-el:hover .el-s {
    color: var(--accent-blue);
    text-shadow: 0 0 15px rgba(0, 191, 255, 0.7);
}

.el.active-el:hover .el-cat {
    opacity: 1;
    transform: translateY(0);
}

.el.active-el:hover .el-name {
    color: var(--text-white);
    opacity: 1;
}

/* ═══════════════════════════════════════════
   CHARACTERS
   ═══════════════════════════════════════════ */

.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.char-card {
    background: var(--bg-card);
    border: 1px solid rgba(46, 139, 87, 0.25);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    transition: all 0.35s ease;
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.5s, transform 0.5s, border-color 0.35s, box-shadow 0.35s;
}

.char-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.char-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--glow-green);
    transform: translateY(-6px);
}

.char-img-wrap {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #0a0a0a;
}

.char-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.7) contrast(1.1) brightness(0.8);
    transition: all 0.5s;
}

.char-card:hover .char-img-wrap img {
    filter: grayscale(0) contrast(1.0) brightness(0.9);
    transform: scale(1.05);
}

.char-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(18, 18, 18, 0.95) 0%, rgba(18, 18, 18, 0.3) 40%, transparent 60%);
    display: flex;
    align-items: flex-end;
    padding: 0.5rem;
    opacity: 0;
    transition: opacity 0.4s;
}

.char-card:hover .char-overlay {
    opacity: 1;
}

.char-element {
    font-size: 1.8rem;
}

.char-info {
    padding: 0.8rem 1rem 1rem;
}

.char-info h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    letter-spacing: 1px;
    color: var(--text-white);
    margin-bottom: 0.2rem;
}

.char-alias {
    color: var(--accent-blue);
    font-size: 0.7rem;
    font-style: italic;
    margin-bottom: 0.3rem;
}

.char-role {
    color: var(--text-sand);
    font-size: 0.65rem;
    opacity: 0.8;
}

/* ═══════════════════════════════════════════
   SEASONS
   ═══════════════════════════════════════════ */

.seasons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.season-card {
    background: var(--bg-card);
    border: 1px solid rgba(46, 139, 87, 0.25);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.35s;
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 0.5s, transform 0.5s, border-color 0.35s, box-shadow 0.35s;
}

.season-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.season-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--glow-green);
    transform: translateY(-6px);
}

.season-img-wrap {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #0a0a0a;
}

.season-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Duotone: Black & Blue */
    filter: grayscale(1) contrast(1.2) brightness(0.7);
    transition: all 0.5s;
}

.season-card:hover .season-img-wrap img {
    filter: grayscale(0.3) contrast(1.1) brightness(0.8) saturate(1.2);
    transform: scale(1.05);
}

.season-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.8rem;
    gap: 0.2rem;
}

.batch-label {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    letter-spacing: 3px;
    color: var(--accent-yellow);
}

.purity {
    font-size: 0.6rem;
    color: var(--accent-blue);
    letter-spacing: 2px;
}

.season-info {
    padding: 0.8rem 1rem 1rem;
}

.season-info h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

.season-meta {
    font-size: 0.65rem;
    color: var(--text-sand);
    margin-bottom: 0.3rem;
}

.season-tagline {
    font-family: 'Courier Prime', var(--font-body);
    font-style: italic;
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-bottom: 0.6rem;
}

/* Purity Bar */
.purity-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.purity-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--border-green), var(--accent-blue));
    border-radius: 2px;
    transition: width 1.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.purity-fill.crystal {
    background: linear-gradient(90deg, var(--accent-blue), #60efff);
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.5);
}

/* ═══════════════════════════════════════════
   FAMILY BANNER
   ═══════════════════════════════════════════ */

.family-banner {
    position: relative;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
    margin: 3rem 0;
    border: 1px solid rgba(46, 139, 87, 0.2);
}

.family-banner img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    object-position: center 30%;
    filter: grayscale(0.5) contrast(1.1) brightness(0.55);
}

.family-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, rgba(18, 18, 18, 0.7), transparent 40%, transparent 60%, rgba(18, 18, 18, 0.7));
}

.family-text p {
    font-family: 'Courier Prime', var(--font-body);
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-style: italic;
    color: var(--text-sand);
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
    letter-spacing: 3px;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

.site-footer {
    text-align: center;
    padding: 4rem 1rem 3rem;
    border-top: 1px solid rgba(46, 139, 87, 0.15);
}

.footer-logo {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.footer-quote {
    font-family: 'Courier Prime', var(--font-body);
    font-style: italic;
    color: var(--text-sand);
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 1rem;
}

.footer-copy {
    font-size: 0.6rem;
    color: rgba(245, 245, 245, 0.3);
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 900px) {
    .periodic-table {
        grid-template-columns: repeat(4, 1fr);
    }

    .characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 600px) {
    .periodic-table {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero-title {
        font-size: clamp(2.2rem, 10vw, 4rem);
    }

    .characters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .seasons-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }

    .family-banner img {
        height: 200px;
    }

    section {
        padding: 3rem 0;
    }
}

@media (max-width: 400px) {

    .characters-grid,
    .seasons-grid {
        grid-template-columns: 1fr;
    }
}

/* ───── SCROLLBAR ───── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-green);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ═══════════════════════════════════════════
   DEADLY DUO
   ═══════════════════════════════════════════ */

.section-duo {
    padding: 6rem 2rem;
}

.duo-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2.5rem;
    align-items: center;
}

.duo-image-stack {
    position: relative;
    height: 500px;
}

.duo-img-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--accent-green);
    box-shadow: 0 0 30px rgba(46, 139, 87, 0.3);
    transition: transform 0.5s ease;
}

.duo-img-secondary {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 180px;
    height: 220px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--accent-blue);
    box-shadow: 0 0 25px rgba(0, 191, 255, 0.4);
    transition: transform 0.5s ease;
    z-index: 2;
}

.duo-image-stack:hover .duo-img-main {
    transform: scale(1.02);
}

.duo-image-stack:hover .duo-img-secondary {
    transform: translate(-10px, -10px) scale(1.05);
}

.duo-content {
    padding: 2rem;
    background: rgba(46, 139, 87, 0.05);
    border: 1px solid rgba(46, 139, 87, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.duo-elements {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.el-box.md {
    width: 60px;
    height: 70px;
    font-size: 1.4rem;
}

.el-box.md .el-num {
    font-size: 0.6rem;
}

.duo-plus,
.duo-equals {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--accent-green);
}

.duo-result {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
    letter-spacing: 2px;
}

.duo-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--text-white);
    letter-spacing: 3px;
    margin-bottom: 1rem;
}

.duo-text {
    color: var(--text-sand);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.duo-timeline {
    margin-top: 1.5rem;
    padding-left: 1.2rem;
    border-left: 2px solid var(--accent-green);
}

.duo-moment {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0;
    color: var(--text-white);
    font-size: 0.9rem;
    font-family: var(--font-body);
}

.duo-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-blue);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.6);
    animation: pulseDuo 2s infinite ease-in-out;
}

@keyframes pulseDuo {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(0, 191, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 12px rgba(0, 191, 255, 0.8);
    }
}

@media (max-width: 768px) {
    .duo-showcase {
        grid-template-columns: 1fr;
    }

    .duo-image-stack {
        height: 300px;
    }

    .duo-img-secondary {
        width: 120px;
        height: 150px;
    }
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-container {
    background: var(--bg-card);
    border: 1px solid var(--border-green);
    border-radius: 6px;
    max-width: 750px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 191, 255, 0.1);
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from {
        transform: scale(0.95) translateY(15px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: sticky;
    top: 0;
    float: right;
    background: rgba(18, 18, 18, 0.8);
    border: 1px solid rgba(46, 139, 87, 0.3);
    color: var(--text-white);
    font-size: 1.8rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    border-radius: 0 6px 0 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--accent-blue);
    color: var(--bg-dark);
}

/* ─── Character Modal ─── */
.modal-character {
    padding: 0;
}

.modal-char-header {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(46, 139, 87, 0.1), rgba(0, 191, 255, 0.05));
    border-bottom: 1px solid rgba(46, 139, 87, 0.2);
}

.modal-char-header img {
    width: 140px;
    height: 180px;
    object-fit: cover;
    border: 2px solid var(--border-green);
    border-radius: 4px;
    filter: contrast(1.1);
}

.modal-char-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-element-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, #1e5a3a, #2E8B57);
    border: 2px solid var(--border-green);
    width: 55px;
    height: 55px;
    justify-content: center;
    position: relative;
    margin-bottom: 0.5rem;
}

.modal-element-box .me-num {
    font-size: 0.55rem;
    position: absolute;
    top: 3px;
    right: 5px;
    color: rgba(255, 255, 255, 0.7);
}

.modal-element-box .me-sym {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--text-white);
}

.modal-char-title h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    letter-spacing: 2px;
}

.modal-alias {
    color: var(--accent-blue);
    font-style: italic;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.modal-status {
    font-size: 0.7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 3px;
    display: inline-block;
    width: fit-content;
}

.modal-status.dead {
    background: rgba(220, 50, 50, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(220, 50, 50, 0.3);
}

.modal-status.alive {
    background: rgba(46, 139, 87, 0.2);
    color: #5dde5d;
    border: 1px solid rgba(46, 139, 87, 0.3);
}

.modal-char-body {
    padding: 1.5rem;
}

.modal-role {
    color: var(--accent-yellow);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.modal-desc {
    color: var(--text-sand);
    font-size: 0.8rem;
    line-height: 1.7;
    margin-bottom: 1.2rem;
}

.modal-char-body h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--accent-blue);
    margin-bottom: 0.6rem;
}

.moments-list {
    list-style: none;
}

.moments-list li {
    font-size: 0.75rem;
    color: var(--text-sand);
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(46, 139, 87, 0.1);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.moment-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-blue);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0, 191, 255, 0.5);
}

/* ─── Season Modal ─── */
.modal-season {
    padding: 0;
}

.modal-season-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(46, 139, 87, 0.2);
    background: linear-gradient(135deg, rgba(46, 139, 87, 0.1), rgba(0, 191, 255, 0.05));
}

.batch-badge {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    letter-spacing: 4px;
    color: var(--accent-yellow);
    background: rgba(212, 175, 55, 0.1);
    padding: 3px 12px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 3px;
}

.modal-season-header h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    letter-spacing: 3px;
    margin-top: 0.4rem;
}

.modal-season-year {
    color: var(--text-sand);
    font-size: 0.75rem;
}

.modal-season-body {
    padding: 0.5rem;
}

.ep-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid rgba(46, 139, 87, 0.1);
    transition: background 0.2s;
    padding: 0.8rem;
    gap: 0.8rem;
}

.ep-row:hover {
    background: rgba(0, 191, 255, 0.03);
}

.ep-number {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--accent-blue);
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ep-info {
    flex: 1;
}

.ep-info h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.ep-info p {
    font-size: 0.65rem;
    color: var(--text-sand);
    line-height: 1.5;
}

.ep-rating {
    min-width: 65px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.rating-num {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-white);
}

.ep-rating.crystal .rating-num {
    color: var(--accent-blue);
    text-shadow: 0 0 10px rgba(0, 191, 255, 0.5);
}

.ep-rating.high .rating-num {
    color: var(--accent-yellow);
}

.rating-label {
    font-size: 0.45rem;
    color: rgba(245, 245, 245, 0.4);
    letter-spacing: 2px;
}

.rating-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.rating-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--border-green), var(--accent-blue));
    border-radius: 2px;
}

/* ═══════════════════════════════════════════
   SCIENCE SECTION
   ═══════════════════════════════════════════ */

.science-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.science-card {
    background: var(--bg-card);
    border: 1px solid rgba(46, 139, 87, 0.25);
    border-radius: 4px;
    padding: 1.5rem;
    transition: all 0.35s;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s, border-color 0.35s, box-shadow 0.35s;
}

.science-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.science-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--glow-green);
}

.sci-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.science-card h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.sci-formula {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.sci-desc {
    font-size: 0.72rem;
    color: var(--text-sand);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.sci-accuracy {
    background: rgba(46, 139, 87, 0.08);
    border-left: 3px solid var(--border-green);
    padding: 0.6rem 0.8rem;
    border-radius: 0 4px 4px 0;
}

.accuracy-label {
    font-size: 0.55rem;
    color: var(--accent-yellow);
    letter-spacing: 2px;
    display: block;
    margin-bottom: 0.3rem;
}

.sci-accuracy p {
    font-size: 0.68rem;
    color: var(--text-sand);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════
   CHATBOT
   ═══════════════════════════════════════════ */

.chat-container {
    max-width: 650px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid rgba(46, 139, 87, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, rgba(46, 139, 87, 0.15), rgba(0, 191, 255, 0.05));
    border-bottom: 1px solid rgba(46, 139, 87, 0.2);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #1e5a3a, #2E8B57);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    border: 2px solid var(--border-green);
}

.chat-header strong {
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 1px;
}

.chat-status {
    display: block;
    font-size: 0.6rem;
    color: #5dde5d;
    letter-spacing: 1px;
}

.chat-messages {
    height: 350px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-msg {
    display: flex;
    max-width: 85%;
}

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg.bot {
    align-self: flex-start;
}

.msg-bubble {
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-size: 0.75rem;
    line-height: 1.6;
    animation: msgIn 0.3s ease;
}

@keyframes msgIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.chat-msg.user .msg-bubble {
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.2), rgba(0, 191, 255, 0.1));
    border: 1px solid rgba(0, 191, 255, 0.3);
    color: var(--text-white);
    border-bottom-right-radius: 3px;
}

.chat-msg.bot .msg-bubble {
    background: rgba(46, 139, 87, 0.12);
    border: 1px solid rgba(46, 139, 87, 0.25);
    color: var(--text-sand);
    border-bottom-left-radius: 3px;
}

.chat-input-area {
    display: flex;
    border-top: 1px solid rgba(46, 139, 87, 0.2);
}

.chat-input-area input {
    flex: 1;
    background: rgba(18, 18, 18, 0.6);
    border: none;
    padding: 0.9rem 1rem;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 0.8rem;
    outline: none;
}

.chat-input-area input::placeholder {
    color: rgba(245, 245, 245, 0.3);
}

.chat-input-area button {
    background: linear-gradient(135deg, var(--border-green), rgba(0, 191, 255, 0.4));
    border: none;
    color: var(--text-white);
    padding: 0.9rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-input-area button:hover {
    background: var(--accent-blue);
    color: var(--bg-dark);
}

/* ═══════════════════════════════════════════
   QUIZ
   ═══════════════════════════════════════════ */

.quiz-container {
    max-width: 650px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid rgba(46, 139, 87, 0.3);
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
}

.quiz-start-btn {
    background: linear-gradient(135deg, var(--border-green), rgba(0, 191, 255, 0.4));
    border: 2px solid var(--border-green);
    color: var(--text-white);
    padding: 1rem 2.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    letter-spacing: 3px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.quiz-start-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--bg-dark);
    box-shadow: var(--glow-blue);
}

.quiz-progress {
    font-size: 0.65rem;
    color: var(--text-sand);
    letter-spacing: 2px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.quiz-q {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.quiz-opt {
    background: rgba(18, 18, 18, 0.6);
    border: 1px solid rgba(46, 139, 87, 0.3);
    color: var(--text-white);
    padding: 0.8rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-align: left;
}

.quiz-opt:hover:not(:disabled) {
    border-color: var(--accent-blue);
    background: rgba(0, 191, 255, 0.08);
}

.quiz-opt.correct {
    border-color: #5dde5d;
    background: rgba(93, 222, 93, 0.15);
    color: #5dde5d;
}

.quiz-opt.wrong {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.quiz-score-bar {
    font-size: 0.65rem;
    color: var(--text-sand);
    letter-spacing: 1px;
}

.quiz-results {
    padding: 1rem 0;
}

.quiz-results h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    letter-spacing: 3px;
    margin-bottom: 1rem;
}

.result-score {
    font-family: var(--font-heading);
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.result-score.crystal {
    color: var(--accent-blue);
    text-shadow: 0 0 20px rgba(0, 191, 255, 0.5);
}

.result-score.high {
    color: var(--accent-yellow);
}

.result-score.mid {
    color: var(--text-sand);
}

.result-score.low {
    color: #ff6b6b;
}

.result-pct {
    font-size: 0.8rem;
    color: var(--text-sand);
    margin-bottom: 0.6rem;
}

.result-rank {
    font-size: 0.85rem;
    color: var(--text-white);
    margin-top: 1rem;
    margin-bottom: 1.2rem;
}

.result-rank strong {
    color: var(--accent-blue);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.quiz-restart {
    background: linear-gradient(135deg, var(--border-green), rgba(0, 191, 255, 0.4));
    border: 2px solid var(--border-green);
    color: var(--text-white);
    padding: 0.7rem 2rem;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    letter-spacing: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.quiz-restart:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--bg-dark);
}

/* ─── Modal Responsive ─── */
@media (max-width: 600px) {
    .modal-char-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-char-header img {
        width: 100px;
        height: 130px;
    }

    .ep-row {
        flex-direction: column;
        gap: 0.4rem;
    }

    .ep-rating {
        flex-direction: row;
        gap: 0.5rem;
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .chat-messages {
        height: 280px;
    }
}

/* ─── Typing Indicator ─── */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    min-height: 1.2em;
}

.typing-dots span {
    animation: typingBounce 1.4s infinite ease-in-out;
    font-size: 1.5rem;
    line-height: 0.5;
    color: var(--accent-blue);
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

.chat-input-area input:disabled,
.chat-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}