:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --text-muted: #888888;
    --accent-color: #84e7ff;
    /* Low-saturated cyan */
    --accent-hover: #ffffff;
    --nav-height: 80px;
    --font-main: 'Noto Sans JP', sans-serif;
    --transition-speed: 0.4s;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out;
}

.loader {
    width: 40px;
    height: 40px;
    border: 2px solid var(--text-muted);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    z-index: 1000;
    transition: padding 0.3s ease;
}

header.scrolled {
    padding: 0 4%;
    background: rgba(5, 5, 5, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    line-height: 1.1;
    cursor: default;
}

.logo-main {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-color);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(132, 231, 255, 0.3);
}

.logo-sub {
    font-family: var(--font-main);
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-left: 2px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 3rem;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    transition: color 0.3s, text-shadow 0.3s;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

nav a:hover,
nav a.active {
    color: var(--text-color);
    text-shadow: 0 0 8px var(--accent-color);
}

nav a:hover::after {
    width: 100%;
}

.amadeus-link {
    color: #00f2ff !important;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
    border: 1px solid rgba(0, 242, 255, 0.2);
    padding: 6px 15px !important;
    border-radius: 4px;
    background: rgba(0, 242, 255, 0.05);
}

.amadeus-link:hover {
    background: rgba(0, 242, 255, 0.15) !important;
    border-color: #00f2ff !important;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.amadeus-link::after {
    display: none !important;
    /* Remove the underline effect for this special button */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.fan-club-btn {
    background: rgba(255, 255, 255, 0.05);
    /* 极淡的背景 */
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 24px;
    font-family: 'Cinzel', serif;
    /* 保持一致的衬线体 */
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

/* 点击时的反馈 */
.fan-club-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
}

.fan-club-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.social-icons span {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.social-icons span:hover {
    color: var(--text-color);
}

/* Hero Section */
#hero {
    height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 70% 30%, #1a1a2e 0%, #000000 70%);
    z-index: -1;
    transform: scale(1.1);
    animation: breathe 10s infinite alternate;
}

/* Simple atmospheric animation for BG */
@keyframes breathe {
    0% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1.2);
    }
}

.hero-content {
    text-align: center;
    z-index: 2;
}

h1 {
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 3rem;
}

.hero-btn {
    display: inline-block;
    white-space: nowrap;
    padding: 12px 40px;
    background: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    transition: all var(--transition-speed);
}

.hero-btn:hover {
    background: var(--text-color);
    color: #000;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.6;
}

.scroll-indicator span {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    writing-mode: vertical-rl;
}

.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, #fff, transparent);
    animation: scrollDown 2s infinite;
}

@keyframes scrollDown {
    0% {
        transform: scaleY(0);
        transform-origin: top;
    }

    50% {
        transform: scaleY(1);
        transform-origin: top;
    }

    51% {
        transform: scaleY(1);
        transform-origin: bottom;
    }

    100% {
        transform: scaleY(0);
        transform-origin: bottom;
    }
}

/* Generic Section Styles */
.section {
    padding: 100px 10%;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    margin-bottom: 60px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: var(--accent-color);
    margin: 20px auto 0;
}

/* Hero Tags */
.hero-tags {
    color: var(--text-color);
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    font-family: monospace;
}

.hero-tags span {
    color: var(--accent-color);
}

/* Two Column Layout for Learning Sections */
.content-split {
    display: flex;
    align-items: center;
    gap: 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.content-split.reverse {
    flex-direction: row-reverse;
}

.text-block {
    flex: 1;
}

/* Visual Blocks with Images */
.visual-block {
    flex: 1;
    height: 400px;
    background-color: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.2, 1, 0.3, 1);
}

.visual-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.8s ease;
    opacity: 0.6;
    filter: grayscale(80%) contrast(1.2);
}

.visual-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, #050505 120%);
    z-index: 1;
}

/* Specific Image Backgrounds */
.math-viz::before {
    background-image: url('../images/math-bg.png');
}

.phys-viz::before {
    background-image: url('../images/physics-bg.png');
}

.cs-viz::before {
    background-image: url('../images/cs-bg.png');
}

.comm-viz::before {
    background-image: url('../images/comm-bg.png');
}

/* Hover effects */
.content-split:hover .visual-block {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.content-split:hover .visual-block::before {
    transform: scale(1.1);
    filter: grayscale(0%) contrast(1.1);
    opacity: 0.8;
}

/* Intro Text Styling Update */
.intro {
    font-family: 'Noto Serif JP', serif;
    font-size: 1.1rem;
    color: #aaa;
    margin-bottom: 2rem;
    line-height: 2;
    font-weight: 300;
}

.view-more {
    display: inline-block;
    white-space: nowrap;
    margin-top: 20px;
    padding: 10px 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.view-more:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Responsive Updates */
@media (max-width: 768px) {

    .content-split,
    .content-split.reverse {
        flex-direction: column;
        gap: 30px;
    }

    .visual-block {
        width: 100%;
        height: 200px;
    }
}

/* Animation Utilities */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 {
    transition-delay: 0.2s;
}

.delay-2 {
    transition-delay: 0.4s;
}

/* Footer */
footer {
    text-align: center;
    padding: 60px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer-logo {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 20px;
    letter-spacing: 0.05em;
    font-family: 'Cinzel', serif;
}


/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1500;
}

.hamburger span {
    width: 30px;
    height: 2px;
    background: var(--text-color);
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(5, 5, 5, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1400;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: right 0.4s cubic-bezier(0.77, 0.2, 0.05, 1.0);
}

.mobile-nav-overlay.active {
    right: 0;
}

.mobile-nav-links {
    list-style: none;
    text-align: center;
}

.mobile-nav-links li {
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-in-out;
}

/* Stagger animation for links */
.mobile-nav-overlay.active .mobile-nav-links li:nth-child(1) {
    transition-delay: 0.1s;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-overlay.active .mobile-nav-links li:nth-child(2) {
    transition-delay: 0.2s;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-overlay.active .mobile-nav-links li:nth-child(3) {
    transition-delay: 0.3s;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-overlay.active .mobile-nav-links li:nth-child(4) {
    transition-delay: 0.4s;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-overlay.active .mobile-nav-links li:nth-child(5) {
    transition-delay: 0.5s;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.5rem;
    letter-spacing: 0.2em;
    font-weight: 300;
}

/* Responsive Styles */

/* Tablet (iPad) optimizations */
@media (max-width: 1024px) {
    :root {
        --nav-height: 70px;
    }

    /* Adjust navbar spacing */
    nav#desktop-nav ul {
        gap: 1.5rem;
    }

    nav#desktop-nav a {
        font-size: 0.8rem;
    }

    .section-title {
        font-size: 2rem;
    }

    h1 {
        font-size: 3rem;
    }

    .content-split {
        gap: 25px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --nav-height: 60px;
    }

    header {
        padding: 0 5%;
    }

    /* Hide desktop nav */
    nav#desktop-nav {
        display: none;
    }

    /* Show hamburger */
    .hamburger {
        display: flex;
    }

    /* Layout adjustments */
    h1 {
        font-size: 2.2rem;
        padding: 0 20px;
        line-height: 1.3;
    }

    .hero-content p {
        font-size: 1rem;
        padding: 0 20px;
    }

    .hero-tags {
        font-size: 0.7rem;
    }

    .section {
        padding: 60px 5%;
    }

    .section-title {
        font-size: 1.8rem;
        letter-spacing: 0.2em;
    }

    .content-split,
    .content-split.reverse {
        flex-direction: column;
        gap: 25px;
    }

    /* Ensure visual block is always second on mobile if desired, or keep natural order */
    /* If we want visual block always after text: */
    .content-split.reverse {
        flex-direction: column;
    }

    .visual-block {
        width: 100%;
        height: 250px;
        order: -1;
        /* Place visuals on top on mobile for better engagement */
    }

    .text-block {
        text-align: left;
        /* Or center if preferred */
    }

    /* Modal adjustments */
    .modal-content {
        width: 90%;
        padding: 30px 20px;
    }
}

/* ReoNa Style Auth Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Deep dark overlay */
    backdrop-filter: blur(8px);
    /* Frost effect */
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    /* Ensure it doesn't block clicks when hidden */
}

.modal-content {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 60px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    text-align: center;
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.modal.hidden .modal-content {
    transform: translateY(30px);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    font-family: 'Cinzel', serif;
}

.close-modal:hover {
    color: #fff;
    transform: rotate(90deg);
}

.modal-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    margin-bottom: 40px;
    color: #fff;
    letter-spacing: 0.2em;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    display: inline-block;
    white-space: nowrap;
}

/* Minimalist Inputs */
.input-group {
    margin-bottom: 30px;
    text-align: left;
    position: relative;
}

.input-group label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: #888;
    letter-spacing: 0.15em;
    margin-bottom: 10px;
    display: block;
    transition: color 0.3s;
}

.input-group input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    padding: 10px 0;
    color: #fff;
    font-family: 'Noto Serif JP', serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.4s, padding-bottom 0.4s;
    border-radius: 0;
    /* Remove default radius */
}

.input-group input:focus {
    border-bottom-color: #fff;
    padding-bottom: 12px;
}

.input-group input:focus+label,
.input-group:focus-within label {
    color: #fff;
}

/* Auth Button */
.auth-btn {
    width: 100%;
    padding: 15px;
    background: #fff;
    color: #000;
    border: 1px solid #fff;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    margin-top: 20px;
    text-transform: uppercase;
}

.auth-btn:hover {
    background: transparent;
    color: #fff;
    letter-spacing: 0.3em;
}

/* Switch Auth Text */
.switch-auth {
    margin-top: 30px;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.8em;
    color: #666;
}

.switch-auth span {
    color: #aaa;
    cursor: pointer;
    text-decoration: none;
    margin-left: 5px;
    transition: color 0.3s;
    border-bottom: 1px solid transparent;
}

.switch-auth span:hover {
    color: #fff;
    border-bottom-color: #fff;
}

/* Specific adjustment for hidden forms inside modal */
#login-form-container.hidden,
#register-form-container.hidden {
    display: none;
}

/* Apple x ReoNa Style Grid Layout */
/* 1. 修复网格中 a 标签的布局行为 */
.subject-grid>a {
    display: block;
    /* 关键：让 a 标签变成块级容器 */
    height: 100%;
    /* 撑满网格单元的高度 */
    text-decoration: none;
    /* 移除下划线 */
    color: inherit;
    /* 继承颜色 */
    position: relative;
    /* 建立定位上下文 */
}

/* 2. 修正卡片层级和弹性布局 */
.bento-card {
    /* 保持原有样式 */
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 40px;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);

    /* 新增/修改以下布局属性 */
    display: flex;
    flex-direction: column;
    /* 垂直排列内容 */
    justify-content: space-between;
    height: 100%;
    /* 确保卡片填满 a 标签 */
    z-index: 1;
    /* 建立堆叠上下文 */
    position: relative;
    /* 必须保留 */
}

/* 3. 修复辉光动画覆盖文字的问题 (关键修复) */
.bento-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    transform: translate(-50%, -50%);

    /* 核心修改：将辉光置于最底层 */
    z-index: -1;
    pointer-events: none;
    /* 防止辉光层拦截鼠标事件 */
}

/* 4. 确保内容永远在背景之上 */
.card-content {
    position: relative;
    z-index: 2;
    /* 提高文字层级 */
    flex-grow: 1;
    /* 让内容区占据剩余空间 */
}

/* 5. 确保标题和文字清晰 */
.bento-card h3,
.bento-card p,
.bento-card .sub-topics {
    position: relative;
    z-index: 2;
}

/* 6. 按钮/链接样式修正 */
.card-link {
    position: relative;
    z-index: 2;
    /* 提高按钮层级 */
    margin-top: 20px;
    /* 增加顶部间距 */
    align-self: flex-start;
    /* 左对齐按钮 */
    /* 保持原有的样式... */
}

/* 修复大卡片在 a 标签包裹下的网格跨度 */
.subject-grid>a.large-span {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .subject-grid>a.large-span {
        grid-column: span 1;
    }
}



/* Enhanced CSS with Navigation and Animations */

/* Add to existing style.css */

/* Smooth Navigation Bar */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 20px 5%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.main-nav.hidden {
    transform: translateY(-100%);
}

.main-nav.scrolled {
    background: rgba(5, 5, 5, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-logo {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: #fff;
    letter-spacing: 0.15em;
    text-decoration: none;
    transition: color 0.3s;
}

.nav-logo:hover {
    color: #aaa;
}

.nav-links {
    display: flex;
    gap: 25px;
    list-style: none;
    margin: 0;
    padding: 0;
}


/* Fixed Navigation Link Styles */
.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    position: relative;
    transition: color 0.3s;
    display: inline-block;
    white-space: nowrap;
    /* Prevent text shifting */
    padding-bottom: 5px;
    /* Space for underline */
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #fff;
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: #fff;
}

.nav-links a:hover::after {
    width: 100%;
}


@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
}

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

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

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
    }
}

@keyframes floatAnimation {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.animate-on-scroll {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

/* Enhanced Card Hover Effects */
.bento-card {
    position: relative;
    overflow: hidden;
}

.bento-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    transform: translate(-50%, -50%);
}

.bento-card:hover::before {
    opacity: 1;
    animation: glowPulse 2s infinite;
}


/* Fixed Button Styles - Removed problematic animations */
/* ===== 边框内发光变亮按钮效果 ===== */

/* 基础按钮样式 */
.view-more,
.card-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 36px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: #fff;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 内发光层 */
.view-more::after,
.card-link::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 52px;
    background: linear-gradient(45deg,
            rgba(132, 231, 255, 0.1),
            rgba(255, 255, 255, 0.15),
            rgba(132, 231, 255, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
}

/* 文字和箭头样式 */
.card-link span::after {
    content: '→';
    font-size: 1.1em;
    transition: transform 0.4s ease;
    margin-left: 5px;
}

/* 触碰状态 */
.view-more:hover,
.card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* 触碰时内边框发光 */
.view-more:hover::after,
.card-link:hover::after {
    opacity: 1;
}

/* 触碰时箭头移动 */
.card-link:hover span::after {
    transform: translateX(5px);
}

/* Particle Effect Background */
.particle-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: floatAnimation 6s ease-in-out infinite;
}

/* Section Entrance Animations */
.section {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced Hero Section */
#hero {
    position: relative;
}

#hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.8));
}

/* Detail Page Styling */
.detail-hero {
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-title {
    font-family: 'Cinzel', serif;
    font-size: 4rem;
    letter-spacing: 0.3em;
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.3);
}

.detail-content {
    max-width: 1200px;
    margin: 100px auto;
    padding: 0 5%;
}

.category-block {
    margin-bottom: 100px;
    padding: 40px;
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    transition: all 0.4s ease;
}

.category-block:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.category-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    margin-bottom: 20px;
    color: #fff;
    letter-spacing: 0.2em;
}

.category-description {
    font-size: 1.1rem;
    line-height: 2;
    color: #ccc;
    margin-bottom: 30px;
}

.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.subcategory-item {
    padding: 20px;
    background: rgba(30, 30, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.subcategory-item:hover {
    background: rgba(40, 40, 40, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.subcategory-name {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #fff;
}

.subcategory-desc {
    font-size: 0.95rem;
    color: #e0e0e0;
    line-height: 1.7;
    margin-top: 5px;
}


/* ===== NAVIGATION FIXES ===== */
.nav-links {
    display: flex;
    gap: 25px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links li {
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    white-space: nowrap;
    padding-bottom: 5px;
    transition: color 0.3s ease;
    /* Prevent layout shift */
    will-change: auto;
    transform: translateZ(0);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.nav-links a:hover {
    color: #fff;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

/* Ensure nav container doesn't shift */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 20px 5%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Prevent card content shift on hover */
.bento-card {
    position: relative;
    overflow: hidden;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}




/* ===== MOBILE & RESPONSIVE DESIGN ===== */

/* Hamburger Menu Icon */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 10px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* Mobile Sidebar Navigation */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: rgba(15, 15, 15, 0.98);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 1000;
    padding: 100px 40px 40px;
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-sidebar.active {
    right: 0;
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mobile-nav-links li {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.4s ease;
}

.mobile-sidebar.active .mobile-nav-links li {
    opacity: 1;
    transform: translateX(0);
}

.mobile-sidebar.active .mobile-nav-links li:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-sidebar.active .mobile-nav-links li:nth-child(2) {
    transition-delay: 0.15s;
}

.mobile-sidebar.active .mobile-nav-links li:nth-child(3) {
    transition-delay: 0.2s;
}

.mobile-sidebar.active .mobile-nav-links li:nth-child(4) {
    transition-delay: 0.25s;
}

.mobile-sidebar.active .mobile-nav-links li:nth-child(5) {
    transition-delay: 0.3s;
}

.mobile-nav-links a {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.mobile-nav-links a:hover {
    color: #aaa;
    padding-left: 10px;
}

/* Overlay for sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 999;
}

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

/* Tablet Breakpoint (iPad) */
@media (max-width: 1024px) {
    .nav-links {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .hero-title,
    .detail-title {
        font-size: 3.5rem;
    }

    .subject-grid,
    .subcategory-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .bento-card.large {
        grid-column: span 1;
    }

    .detail-content {
        padding: 0 8%;
    }
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
    .main-nav {
        padding: 15px 5%;
    }

    .nav-logo {
        font-size: 1rem;
    }

    .mobile-sidebar {
        width: 80%;
        max-width: 300px;
    }

    /* Hero sections */
    #hero {
        min-height: 80vh;
    }

    .hero-title {
        font-size: 2.5rem;
        letter-spacing: 0.15em;
    }

    .detail-title {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    /* Grid layouts */
    .subject-grid,
    .subcategory-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 5%;
        margin-top: 20px;
    }

    .bento-card {
        min-height: 250px;
        padding: 30px;
    }

    .bento-card.large {
        grid-column: span 1;
    }

    /* Content sections */
    .content-split {
        flex-direction: column;
    }

    .content-split.reverse {
        flex-direction: column;
    }

    .section-title {
        font-size: 2rem;
    }

    .category-title {
        font-size: 1.5rem;
    }

    .category-block {
        padding: 30px 20px;
        margin-bottom: 50px;
    }

    .detail-content {
        margin: 50px auto;
        padding: 0 5%;
    }

    /* Buttons */
    .view-more,
    .card-link {
        padding: 10px 25px;
        font-size: 0.75rem;
    }

    /* Footer */
    footer {
        padding: 30px 0;
        font-size: 0.8rem;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .detail-title {
        font-size: 1.8rem;
    }

    .nav-logo {
        font-size: 0.9rem;
    }

    .hamburger {
        width: 25px;
        height: 20px;
    }

    .hamburger span {
        height: 2px;
    }

    .mobile-sidebar {
        padding: 80px 30px 30px;
    }

    .mobile-nav-links a {
        font-size: 1rem;
    }

    .bento-card {
        padding: 25px;
        min-height: 200px;
    }
}

/* Landscape orientation for phones */
@media (max-width: 768px) and (orientation: landscape) {

    #hero,
    .detail-hero {
        min-height: 100vh;
    }

    .mobile-sidebar {
        padding-top: 70px;
    }
}

/* iPad Pro */
@media (min-width: 1024px) and (max-width: 1366px) {
    .detail-content {
        max-width: 900px;
    }

    .subject-grid {
        max-width: 1200px;
    }
}

/* =========================================
   1. 电影感文字进场 (替换原有的 .fade-in-up)
   ========================================= */
@keyframes cinematicReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(10px);
        /* 关键：模糊进场 */
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.hero-title,
.detail-title {
    animation: cinematicReveal 1.2s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

/* =========================================
   2. 卡片聚光灯效果 (Spotlight Effect)
   ========================================= */
/* 基础卡片样式优化 */
.bento-card {
    /* 保持原有布局属性 */
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* ...其他原有属性... */

    /* 新增：为聚光灯准备 */
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
    /* 移除背景色的 transition，交给光效 */
}

/* 定义聚光灯的光晕层 */
.bento-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    /* 在内容之下 */

    /* 核心逻辑：使用 CSS 变量 --x 和 --y (由 JS 控制) */
    background: radial-gradient(800px circle at var(--x, 50%) var(--y, 50%),
            rgba(255, 255, 255, 0.06),
            transparent 40%);
    opacity: 0;
    /* 默认隐藏 */
    transition: opacity 0.4s ease;
    pointer-events: none;
}

/* 鼠标悬停时显示光晕 */
.bento-card:hover::before {
    opacity: 1;
}

/* 增强边框发光 (边框聚光灯) */
.bento-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    border-radius: 20px;
    padding: 1px;
    /* 模拟边框宽度 */

    background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%),
            rgba(255, 255, 255, 0.4),
            transparent 40%);

    /* --- 兼容性核心修改开始 --- */

    /* 1. 针对 Chrome, Safari, Edge (Webkit内核) */
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    /* Webkit 使用 xor 实现挖空 */

    /* 2. 针对 Firefox 和 标准浏览器 (Standard) */
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask-composite: exclude;
    /* 标准属性使用 exclude 实现挖空 */

    /* --- 兼容性核心修改结束 --- */

    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.bento-card:hover::after {
    opacity: 1;
}

/* =========================================
   3. 网格交错入场 (Staggered Entrance)
   ========================================= */
/* 初始状态：隐藏 */
.subject-grid>a {
    opacity: 0;
    transform: translateY(30px);
}

/* 进场动画定义 */
@keyframes gridPopUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 当父容器有 .visible 类时触发动画 */
.subject-grid.visible>a {
    animation: gridPopUp 0.8s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

/* 为每个子元素设置不同的延迟 */
.subject-grid.visible>a:nth-child(1) {
    animation-delay: 0.1s;
}

.subject-grid.visible>a:nth-child(2) {
    animation-delay: 0.2s;
}

.subject-grid.visible>a:nth-child(3) {
    animation-delay: 0.3s;
}

.subject-grid.visible>a:nth-child(4) {
    animation-delay: 0.4s;
}

.subject-grid.visible>a:nth-child(5) {
    animation-delay: 0.5s;
}

/* ========================================= */
/*      Enhanced Bento Card Typography       */
/* ========================================= */

.card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #fff;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: color 0.3s ease;
}

.bento-card:hover .card-title {
    color: var(--accent-color);
}

.card-subtitle {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1rem;
    color: #e0e0e0;
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
}

.card-subtitle .label {
    font-weight: 700;
    color: var(--accent-color);
    margin-right: 8px;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.card-desc {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.95em;
    color: #bbb;
    line-height: 1.7;
    margin-bottom: 20px;
}

.card-footer {
    font-family: 'Noto Serif JP', serif;
    font-style: italic;
    font-size: 0.85em;
    color: #777;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    transition: color 0.3s ease;
}

.bento-card:hover .card-footer {
    color: #aaa;
}

.page-footer {
    margin-top: 100px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 50px 0;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* ========================================= */
/*      Technical Documentation Styles       */
/* ========================================= */

.tech-code-block {
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-left: 3px solid var(--accent-color);
    padding: 24px;
    margin: 20px 0;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    color: #ffffff;
    overflow-x: auto;
    line-height: 1.7;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.tech-code-line {
    display: block;
    margin-bottom: 5px;
}

.tech-comment {
    color: #6a9955;
    font-style: italic;
}

.tech-keyword {
    color: var(--accent-color);
    font-weight: bold;
}

.tech-highlight {
    background: rgba(132, 231, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    color: #ffffff;
    font-family: monospace;
    font-size: 0.95em;
    border: 1px solid rgba(132, 231, 255, 0.2);
    box-shadow: 0 0 10px rgba(132, 231, 255, 0.1);
}

.definition-box {
    background: linear-gradient(90deg, rgba(132, 231, 255, 0.1) 0%, rgba(132, 231, 255, 0.02) 100%);
    border-left: 4px solid var(--accent-color);
    padding: 25px;
    margin: 25px 0;
    font-style: italic;
    color: #ffffff;
    font-size: 1.05rem;
    line-height: 1.8;
    border-radius: 0 10px 10px 0;
}/* Enhanced Navigation Bar Appearance */
.main-nav {
    padding: 15px 5%; /* Slightly more compact vertically */
}

.nav-links {
    gap: 30px;
}

.nav-links a {
    font-family: 'Cinzel', serif; /* Use the premium font for links too */
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
}

.nav-links a:hover {
    color: var(--accent-color);
    text-shadow: 0 0 8px rgba(132, 231, 255, 0.5);
}

.nav-links a.active {
    color: var(--accent-color);
}

/* Ensure Logo doesn't shrink too much but also doesn't push links away */
.nav-logo {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Responsive adjustments for mid-size screens */
@media (max-width: 1200px) {
    .nav-links {
        gap: 15px;
    }
    .nav-links a {
        font-size: 0.75rem;
        letter-spacing: 0.1em;
    }
}

/* ========================================= */
/*            Read Mode Configuration        */
/* ========================================= */

.read-mode-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.read-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.read-mode-toggle.active {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
}

/* Read Mode Active State */
body.read-mode {
    background: #111; /* Slightly lighter background for reading contrast */
}

body.read-mode .main-nav,
body.read-mode .page-footer,
body.read-mode .subpage-hero,
body.read-mode .detail-hero {
    display: none !important;
}

body.read-mode .detail-content,
body.read-mode .article-content {
    max-width: 800px;
    margin: 60px auto;
    padding: 0 20px;
    font-size: 1.2rem;
    line-height: 2;
}

body.read-mode .mobile-sidebar,
body.read-mode .sidebar-overlay {
    display: none;
}

body.read-mode h2.category-title {
    margin-top: 60px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}

/* ========================================= */
/*          CS Hero Optimization             */
/* ========================================= */
.hero-content-wrapper {
    position: relative;
    z-index: 5;
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
}

.hero-glitch {
    font-family: 'Cinzel', serif;
    font-size: 6rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.1em;
    position: relative;
    text-shadow: 2px 2px 0px rgba(0, 242, 255, 0.3), -2px -2px 0px rgba(255, 0, 85, 0.3);
    animation: glitch-skew 3s infinite linear alternate-reverse;
}

.hero-glitch::before,
.hero-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.hero-glitch::before {
    color: #0ff;
    z-index: -1;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(-2px, -2px);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.hero-glitch::after {
    color: #f0f;
    z-index: -2;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    transform: translate(2px, 2px);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

.hero-text {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 1.1rem;
    color: #ccc;
    margin-top: 20px;
    line-height: 1.8;
    opacity: 0;
    animation: fadeInUp 1s ease 0.5s forwards;
}

.hero-text strong {
    color: var(--accent-color);
    font-weight: 500;
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    10% { transform: skew(0deg); }
    20% { transform: skew(0deg); }
    30% { transform: skew(0deg); }
    40% { transform: skew(0deg); }
    50% { transform: skew(0deg); }
    60% { transform: skew(0deg); }
    70% { transform: skew(0deg); }
    80% { transform: skew(2deg); }
    90% { transform: skew(-2deg); }
    100% { transform: skew(0deg); }
}

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); transform: translate(-2px, 0); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, 0); }
    40% { clip-path: inset(40% 0 50% 0); transform: translate(-2px, 0); }
    60% { clip-path: inset(80% 0 5% 0); transform: translate(2px, 0); }
    80% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, 0); }
    100% { clip-path: inset(30% 0 50% 0); transform: translate(2px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); transform: translate(2px, 0); }
    20% { clip-path: inset(30% 0 20% 0); transform: translate(-2px, 0); }
    40% { clip-path: inset(70% 0 10% 0); transform: translate(2px, 0); }
    60% { clip-path: inset(20% 0 50% 0); transform: translate(-2px, 0); }
    80% { clip-path: inset(50% 0 30% 0); transform: translate(2px, 0); }
    100% { clip-path: inset(0% 0 80% 0); transform: translate(-2px, 0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================= */
/*      MathJax Formula Overflow Fix         */
/* ========================================= */
.subcategory-item {
    overflow-x: auto;
    min-width: 0;
}

mjx-container[jax="CHTML"][display="true"] {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding: 6px 0;
    margin: 0.8em 0 !important;
}

mjx-container[jax="CHTML"] {
    max-width: 100%;
}

