@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;700&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=Courier+Prime:wght@400;700&display=swap');

:root {
    /* Icy Horror Theme: 1950s Endicott Preparatory - Darker Overhaul */
    --bg-color: #020408;
    /* Deepest Abyss Blue/Black */
    --bg-secondary: #0a0f16;
    /* Dark Midnight Blue */
    --text-primary: #ffffff;
    /* Pure White */
    --text-secondary: #d1d5db;
    /* Light Zinc/Gray */
    --accent-color: #3b82f6;
    /* Moonlit Blue - Stronger contrast against black */
    --accent-hover: #60a5fa;
    /* Lighter Blue */
    --border-color: rgba(59, 130, 246, 0.2);

    --sidebar-width: 280px;
    --font-heading: 'Playfair Display',
        serif;
    /* 1950s Newspaper/Formal */
    --font-body: 'Courier Prime',
        monospace;
    /* Typewriter feel */

    /* Glassmorphism - Darker Frozen Glass */
    --glass-bg: rgba(2, 4, 8, 0.9);
    --glass-border: rgba(59, 130, 246, 0.15);
    --glass-blur: 12px;
    --glass-noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");

    /* Animation Tokens */
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes text-pulse-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.1));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.4));
    }
}

/* Highlight Colors */
::selection {
    background: var(--accent-color);
    color: #fff;
    text-shadow: none;
}

::target-text {
    background-color: var(--accent-color);
    animation: highlight-fade 2s 2.5s forwards;
    /* Wait 2.5s, then fade over 2s */
    color: #fff;
    text-shadow: none;
}

@keyframes highlight-fade {
    0% {
        background-color: var(--accent-color);
    }

    70% {
        background-color: var(--accent-color);
    }

    100% {
        background-color: transparent;
    }
}

strong,
b {
    background: linear-gradient(135deg, #fff 0%, var(--accent-color) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow: hidden;
    /* App-like feel */
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Mobile Header */
.mobile-header {
    display: none;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.mobile-header .logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    margin-left: 1rem;
}

#menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(rgba(2, 4, 8, 0.7), rgba(2, 4, 8, 0.7)), var(--glass-noise);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    z-index: 20;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 2rem;
}



.nav-content {
    padding: 0 1rem 2rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.nav-group {
    margin-bottom: 0.5rem;
}

.nav-group-title {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.6rem;
    /* Increased padding area for click target */
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    transition: all 0.2s ease;
    user-select: none;
}

.nav-group-title:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-group-title .chevron {
    transition: transform 0.2s ease;
}

.nav-group-title.open .chevron {
    transform: rotate(90deg);
}

.nav-group-content {
    display: none;
    padding-left: 0.5rem;
    /* Indent content slightly less than before as strict folder structure might be enough */
}

.nav-group-content.open {
    display: block;
    animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.nav-item {
    display: block;
    padding: 0.25rem 0.6rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
    scroll-behavior: smooth;
    position: relative;
    z-index: 10;
}

/* Sidebar Hover & Active States */
.nav-item:hover,
.nav-group-title:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
    color: var(--text-primary);
    border-left: 2px solid rgba(59, 130, 246, 0.3);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, transparent 100%);
    color: var(--accent-color);
    border-left: 3px solid var(--accent-color);
    box-shadow: -5px 0 15px rgba(59, 130, 246, 0.1);
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: -5px 0 15px rgba(59, 130, 246, 0.1);
    }

    50% {
        box-shadow: -5px 0 25px rgba(59, 130, 246, 0.25);
    }
}

.folder-icon {
    transition: transform 0.3s var(--ease-out-back);
}

.folder-toggle.open .folder-icon {
    transform: rotate(90deg);
}

.nav-folder {
    display: none;
    padding-left: 1rem;
    position: relative;
}

.nav-folder::before {
    /* Optional: Vertical line for hierarchy visual */
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
    opacity: 0.5;
}

.nav-folder.open {
    display: block;
    animation: slide-down 0.2s ease-out;
}

/* Updated Gradient Text for Logo */
/* Updated Sidebar Header Structure */
.sidebar-header .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center alignment */
    text-align: center;
    text-decoration: none;
    line-height: 1.2;
    cursor: pointer;
    width: 100%;
}

.logo-top {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    /* Slightly smaller to allow spacing */
    font-weight: 600;
    color: #ffffff;
    /* Bright white */
    letter-spacing: 0.12em;
    /* Stretch to match Endicott */
    margin-bottom: 0px;
    white-space: nowrap;
}

.logo-endicott {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 2.6rem;
    letter-spacing: 0.05em;
    color: #ffffff;
    text-transform: uppercase;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
    margin: 4px 0;
    line-height: 1;
}

.logo-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.7rem;
    color: #ffffff;
    opacity: 1;
    /* Improved visibility */
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.sidebar-header .logo:hover .logo-endicott {
    color: var(--accent-hover);
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.6));
    transition: all 0.3s ease;
}



/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 4rem;
    /* Generous padding */
    scroll-behavior: smooth;
    position: relative;
}

/* Markdown Typography */
.markdown-body {
    max-width: 800px;
    margin: 0 auto;
    color: #e4e4e7;
    font-size: 1.1rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.markdown-body h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    text-align: center;
    /* We need to reset the text fill specifically for the border to be visible if it was text? No, border is separate. */
}

.markdown-body h2 {
    font-size: 2rem;
    font-weight: 600;
}

.markdown-body h3 {
    font-size: 1.5rem;
    font-weight: 500;
}

.markdown-body p {
    margin-bottom: 1.5rem;
    color: #d4d4d8;
}

.markdown-body a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.markdown-body a:hover {
    border-bottom-color: var(--accent-color);
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Menlo', monospace;
    font-size: 0.9em;
}

.markdown-body pre {
    background: #18181b;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Banner Header Styling - Updated to be just text */
.banner-header {
    margin: 2rem 0 3rem 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    position: relative;
    overflow: visible;
}

.banner-header::before {
    display: none;
}

.banner-header h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 0;
    border: none;
}

/* Markdown Tables */
.markdown-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2rem 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.markdown-body th {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    font-family: var(--font-heading);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.markdown-body td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.markdown-body tr:last-child td {
    border-bottom: none;
}

.markdown-body tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 60px;
        /* Below header */
        left: 0;
        bottom: 0;
        z-index: 90;
        transform: translateX(-100%);
        width: 100%;
        border-right: none;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        padding: 5rem 1.5rem 100px;
        /* Top padding for fixed header, large bottom padding for mobile scroll */
        width: 100%;
    }

    .markdown-body h1 {
        font-size: 2.25rem;
    }
}

/* 2026 Aesthetics & Polish */

/* Animated Background Gradient */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%);
    z-index: 0;
    animation: bg-pulse 15s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes bg-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.05);
        /* Reduced scale to prevent "shaking box" feel */
        opacity: 0.4;
    }
}



/* Content Transitions */
.markdown-body {
    animation: fade-in 0.4s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slide-up-fade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Header Anchor Links */
.header-anchor-wrapper {
    position: relative;
    display: inline-block;
}

.header-anchor {
    position: absolute;
    left: -1.2em;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;

    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8em;

    color: #d4af37;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);

    background: none;
    -webkit-text-fill-color: initial;

    text-decoration: none;
    border: none !important;
    cursor: pointer;
    padding: 0.2em;

    /* animation: text-pulse-glow 3s infinite; */
}

h1:hover .header-anchor,
h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor,
h5:hover .header-anchor,
h6:hover .header-anchor {
    opacity: 0.5;
}

.header-anchor:hover {
    opacity: 1 !important;
    transform: translateY(-50%) scale(1.1);
}

/* Copy Feedback Tooltip */
.copy-feedback {
    position: absolute;
    background: var(--accent-color);
    color: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-body);
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    white-space: nowrap;
}

.copy-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

/* Prevent overlap when TOC is present */
@media (min-width: 1201px) {

    /* TOC floats independently - never affects content */
    .main-content.with-toc,
    .main-content.has-toc {
        padding-right: 0 !important;
        margin-right: 0 !important;
    }
}

/* Floating Table of Contents - LEGACY STYLES */
/* Main TOC styles are in fantasystyle.v2.css - unified responsive drawer */

/* --- 1958 Document Styles --- */

/* Base container for styled pages to ensure isolation */
.document-wrapper {
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 4px;
    color: #1a1a1a;
    /* Default dark text for paper docs */
}

/* Handwritten Letter */
.page-letter {
    font-family: 'Caveat', 'Brush Script MT', cursive;
    font-size: 1.4rem;
    background-color: #f7f5e6;
    background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px);
    background-size: 100% 1.8rem;
    line-height: 1.8rem;
    color: #2c2c2c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    padding: 3rem;
    transform: rotate(-1deg);
}

.page-letter h1,
.page-letter h2,
.page-letter h3 {
    font-family: inherit;
    color: #1a1a1a;
    border-bottom: none;
    background: none;
    -webkit-text-fill-color: initial;
    animation: none;
}

/* Newspaper Article */
.page-newspaper {
    font-family: 'Playfair Display', 'Georgia', serif;
    background-color: #1a1a1a;
    color: #e5e5e5;
    padding: 2rem;
    column-count: 2;
    column-gap: 2rem;
    column-rule: 1px solid #444;
    text-align: justify;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.page-newspaper h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 3px double #555;
    column-span: all;
    background: none;
    -webkit-text-fill-color: initial;
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    animation: none;
}

/* Student Handbook / Manual */
.page-handbook {
    font-family: 'Courier Prime', 'Courier New', monospace;
    background-color: #fffaf0;
    color: #333;
    border: 2px solid #555;
    padding: 2rem;
    max-width: 700px;
    margin: 0 auto;
}

.page-handbook h1 {
    font-family: 'Courier Prime', monospace;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 1px solid #333;
    background: none;
    -webkit-text-fill-color: initial;
    color: #333;
    animation: none;
}

/* Novel Page */
.page-novel {
    font-family: 'Merriweather', 'Times New Roman', serif;
    background-color: #faf5e6;
    color: #2b2b2b;
    line-height: 1.8;
    padding: 3rem 4rem;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.05);
}

.page-novel p {
    text-indent: 1.5rem;
    margin-bottom: 0.5rem;
    color: #2b2b2b;
}

.page-novel h1 {
    text-align: center;
    font-style: italic;
    font-weight: normal;
    background: none;
    -webkit-text-fill-color: initial;
    color: #2b2b2b;
    border: none;
    animation: none;
}

/* Override default dark mode text colors when inside these classes */
.page-letter p,
.page-newspaper p,
.page-handbook p,
.page-novel p {
    color: inherit;
}



/* Legacy TOC styles removed - see fantasystyle.v2.css for unified responsive TOC */

/* Footer Styles Removed */
/* Snowfall Effect */
#snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
    /* Increased to 5 */
    overflow: hidden;
}

.snowflake-wrapper {
    position: absolute;
    top: 0;
    pointer-events: none;
    will-change: transform;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.snowflake-wrapper {
    position: absolute;
    top: 0;
    pointer-events: none;
    will-change: transform;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.snowflake {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.4) 40%, transparent 100%);
    opacity: 0.9;
    will-change: transform;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes fall {
    0% {
        transform: translate3d(0, -10vh, 0);
    }

    100% {
        transform: translate3d(0, 110vh, 0);
    }
}

/* Wind Variations */
@keyframes wind-normal {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(50vw, 0, 0);
    }
}

@keyframes wind-flutter {
    0% {
        transform: translate3d(0, 0, 0);
    }

    25% {
        transform: translate3d(10vw, -5px, 0);
    }

    50% {
        transform: translate3d(25vw, 5px, 0);
    }

    75% {
        transform: translate3d(40vw, -2px, 0);
    }

    100% {
        transform: translate3d(50vw, 0, 0);
    }
}

@keyframes wind-fast {
    0% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(30vw, 0, 0);
    }

    /* Accelerates in middle */
    100% {
        transform: translate3d(60vw, 0, 0);
    }
}

/* Special Page Styles */

/* Handwritten Page (Blackwood's Foreword) */
.handwritten-page {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    line-height: 1.8;
    color: #e4e4e7;
    padding: 4rem;
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    transform: rotate(-0.5deg);
    /* Slight organic tilt */
}

.handwritten-page center {
    display: block;
    margin-bottom: 2rem;
    text-align: center;
}

/* 50s Student Handbook (Introduction) */
.handbook-page {
    font-family: 'Courier Prime', monospace;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #d1d5db;
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem;
    background: rgba(10, 14, 20, 0.8);
    border: 1px solid #3b82f6;
    /* handbook border */
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.handbook-page h1 {
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    text-align: center;
    border-bottom: 3px double var(--accent-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

.handbook-page h3 {
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    font-size: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    color: var(--text-primary);
}

.handbook-page p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.handbook-page hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(59, 130, 246, 0.75), rgba(0, 0, 0, 0));
    margin: 2rem 0;
}

/* Deep Link Flash Highlight */
@keyframes flash-fade {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.flash-highlight {
    position: relative;
    /* Ensure relative positioning for pseudo-element */
}

.flash-highlight::before {
    content: '';
    position: absolute;
    top: -0.2em;
    left: -0.4em;
    right: -0.2em;
    bottom: -0.2em;
    background: rgba(95, 203, 240, 0.2);
    border-radius: 6px;
    z-index: -1;
    pointer-events: none;
    animation: flash-fade 2s ease-out forwards;
}

/* Password Protection Overlay */
#password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0F172A;
    /* Dark background matching theme */
    color: #F3F4F6;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

.password-container {
    background: rgba(30, 41, 59, 0.8);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-width: 90%;
    width: 400px;
}

.password-container h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: #60A5FA;
}

.password-container p {
    margin-bottom: 1.5rem;
    color: #9CA3AF;
    line-height: 1.5;
}

#password-input {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 15px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#password-input:focus {
    border-color: #60A5FA;
}

#password-submit {
    width: 100%;
    padding: 10px;
    background-color: #3B82F6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

#password-submit:hover {
    background-color: #2563EB;
}

/* Shake Animation for Invalid Password */
.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}