:root {
    --bg-color: #020202;
    /* Even darker for contrast */
    --text-color: #ffffff;
    --accent-color: #00ffff;
    /* Maximum Cyan */
    --secondary-accent: #d400ff;
    /* Maximum Magenta */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(0, 255, 255, 0.2);
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    overflow-x: hidden;
    position: relative;
    margin: 0;
    overflow-x: hidden;
    position: relative;
    padding-top: 0;
    /* Removed header padding */
}

/* Background Effects */
#space-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -5;
}

.bg-animation {
    display: none;
    /* Replaced by space background */
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200vw;
    height: 200vh;
    background:
        linear-gradient(transparent 0%, rgba(0, 243, 255, 0.02) 50%, transparent 100%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 100% 100%, 60px 60px, 60px 60px;
    transform: perspective(500px) rotateX(60deg) translateY(0);
    z-index: -2;
    pointer-events: none;
    animation: grid-scroll 20s linear infinite;
}

@keyframes grid-scroll {
    0% {
        transform: perspective(500px) rotateX(60deg) translateY(0);
    }

    100% {
        transform: perspective(500px) rotateX(60deg) translateY(60px);
    }
}

#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-color);
    animation: float-particle linear infinite;
    opacity: 0.5;
}

@keyframes float-particle {
    0% {
        transform: translateY(105vh) scale(0);
        opacity: 0;
    }

    20% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

/* Sidebar Navigation */
.sidebar-nav {
    position: fixed;
    top: 0;
    right: 0;
    /* Right side placement */
    width: 250px;
    height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--glass-border);
    z-index: 1000;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Left align items in sidebar */
}

.sidebar-logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    letter-spacing: 2px;
    margin-bottom: 3rem;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    margin: 0;
    padding: 0;
}

.sidebar-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s;
    display: block;
    padding: 8px 12px;
    border-right: 3px solid transparent;
    /* Highlight on right */
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--accent-color);
    text-shadow: 0 0 8px var(--accent-color);
    border-right-color: var(--accent-color);
    background: linear-gradient(270deg, rgba(0, 255, 255, 0.1), transparent);
}

/* Layout Adjustment for Sidebar */
.main-content-with-sidebar {
    margin-right: 250px;
    /* Space for sidebar */
    width: calc(100% - 250px);
}

@media (max-width: 900px) {
    .sidebar-nav {
        width: 100%;
        height: auto;
        bottom: 0;
        top: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 10px;
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }

    .sidebar-logo {
        display: none;
        /* Hide logo on mobile bar */
    }

    .sidebar-nav ul {
        flex-direction: row;
        justify-content: space-around;
        gap: 0;
    }

    .sidebar-nav a {
        font-size: 0.9rem;
        padding: 5px;
        border-right: none;
        border-bottom: 3px solid transparent;
    }

    .sidebar-nav a:hover,
    .sidebar-nav a.active {
        border-right-color: transparent;
        border-bottom-color: var(--accent-color);
        background: none;
    }

    .main-content-with-sidebar {
        margin-right: 0;
        width: 100%;
        padding-bottom: 80px;
        /* Space for bottom nav */
    }
}

/* Hero Section */
.hero-section {
    padding: 60px 20px 40px;
    text-align: center;
    background: linear-gradient(180deg, rgba(0, 243, 255, 0.05) 0%, transparent 100%);
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 40px;
}

h1.glitch {
    font-size: 3.5rem;
    font-weight: 800;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    background-image: linear-gradient(135deg, #00ffff, #ffffff, #d400ff);
    position: relative;
    letter-spacing: 3px;
    margin: 0 auto 1rem;
    max-width: 900px;
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

h1.glitch::before,
h1.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}

h1.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

h1.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--accent-color);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(31px, 9999px, 94px, 0);
        transform: skew(0.85deg);
    }

    5% {
        clip: rect(70px, 9999px, 7px, 0);
        transform: skew(0.19deg);
    }

    10% {
        clip: rect(6px, 9999px, 81px, 0);
        transform: skew(0.51deg);
    }

    15% {
        clip: rect(60px, 9999px, 9px, 0);
        transform: skew(0.67deg);
    }

    20% {
        clip: rect(10px, 9999px, 12px, 0);
        transform: skew(0.48deg);
    }

    25% {
        clip: rect(66px, 9999px, 32px, 0);
        transform: skew(0.77deg);
    }

    30% {
        clip: rect(60px, 9999px, 2px, 0);
        transform: skew(0.76deg);
    }

    35% {
        clip: rect(54px, 9999px, 60px, 0);
        transform: skew(0.18deg);
    }

    40% {
        clip: rect(31px, 9999px, 5px, 0);
        transform: skew(0.71deg);
    }

    45% {
        clip: rect(81px, 9999px, 19px, 0);
        transform: skew(0.97deg);
    }

    50% {
        clip: rect(48px, 9999px, 2px, 0);
        transform: skew(0.6deg);
    }

    55% {
        clip: rect(2px, 9999px, 1px, 0);
        transform: skew(0.77deg);
    }

    60% {
        clip: rect(11px, 9999px, 71px, 0);
        transform: skew(0.86deg);
    }

    65% {
        clip: rect(56px, 9999px, 27px, 0);
        transform: skew(0.38deg);
    }

    70% {
        clip: rect(5px, 9999px, 31px, 0);
        transform: skew(0.46deg);
    }

    75% {
        clip: rect(16px, 9999px, 93px, 0);
        transform: skew(0.95deg);
    }

    80% {
        clip: rect(34px, 9999px, 48px, 0);
        transform: skew(0.53deg);
    }

    85% {
        clip: rect(31px, 9999px, 96px, 0);
        transform: skew(0.1deg);
    }

    90% {
        clip: rect(66px, 9999px, 52px, 0);
        transform: skew(0.12deg);
    }

    95% {
        clip: rect(11px, 9999px, 73px, 0);
        transform: skew(0.11deg);
    }

    100% {
        clip: rect(98px, 9999px, 83px, 0);
        transform: skew(0.81deg);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip: rect(65px, 9999px, 100px, 0);
        transform: skew(0.92deg);
    }

    5% {
        clip: rect(56px, 9999px, 31px, 0);
        transform: skew(0.11deg);
    }

    10% {
        clip: rect(2px, 9999px, 53px, 0);
        transform: skew(0.6deg);
    }

    15% {
        clip: rect(41px, 9999px, 52px, 0);
        transform: skew(0.48deg);
    }

    20% {
        clip: rect(74px, 9999px, 60px, 0);
        transform: skew(0.73deg);
    }

    25% {
        clip: rect(35px, 9999px, 92px, 0);
        transform: skew(0.47deg);
    }

    30% {
        clip: rect(68px, 9999px, 4px, 0);
        transform: skew(0.01deg);
    }

    35% {
        clip: rect(14px, 9999px, 90px, 0);
        transform: skew(0.36deg);
    }

    40% {
        clip: rect(77px, 9999px, 51px, 0);
        transform: skew(0.24deg);
    }

    45% {
        clip: rect(4px, 9999px, 95px, 0);
        transform: skew(0.95deg);
    }

    50% {
        clip: rect(36px, 9999px, 63px, 0);
        transform: skew(0.73deg);
    }

    55% {
        clip: rect(15px, 9999px, 35px, 0);
        transform: skew(0.85deg);
    }

    60% {
        clip: rect(21px, 9999px, 39px, 0);
        transform: skew(0.12deg);
    }

    65% {
        clip: rect(24px, 9999px, 66px, 0);
        transform: skew(0.8deg);
    }

    70% {
        clip: rect(12px, 9999px, 89px, 0);
        transform: skew(0.35deg);
    }

    75% {
        clip: rect(70px, 9999px, 53px, 0);
        transform: skew(0.26deg);
    }

    80% {
        clip: rect(23px, 9999px, 48px, 0);
        transform: skew(0.96deg);
    }

    85% {
        clip: rect(93px, 9999px, 17px, 0);
        transform: skew(0.75deg);
    }

    90% {
        clip: rect(81px, 9999px, 52px, 0);
        transform: skew(0.83deg);
    }

    95% {
        clip: rect(45px, 9999px, 100px, 0);
        transform: skew(0.81deg);
    }

    100% {
        clip: rect(34px, 9999px, 44px, 0);
        transform: skew(0.53deg);
    }
}

.subtitle {
    font-size: 1rem;
    color: #aaa;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Sections */
.content-section {
    padding: 20px 20px 80px;
    max-width: 1100px;
    margin: 40px auto;
    position: relative;
    background: rgba(5, 5, 5, 0.4);
    border: 1px solid rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Tech Decoration Corners */
.content-section::before,
.content-section::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-color);
    transition: all 0.3s ease;
    opacity: 0.5;
    pointer-events: none;
}

.content-section::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.content-section::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.content-section:hover::before,
.content-section:hover::after {
    width: 40px;
    height: 40px;
    opacity: 1;
    box-shadow: 0 0 15px var(--accent-color);
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--secondary-accent);
    padding-left: 15px;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    color: #fff;
}

.byte-deco {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--secondary-accent);
    opacity: 0.7;
    font-weight: 400;
}

/* Grids */
.symbol-grid,
.kaomoji-grid,
.material-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

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

.symbol-item,
.kaomoji-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    color: #ccc;
    user-select: none;
}

.kaomoji-item {
    padding: 5px 10px;
    font-size: 0.9rem;
    height: auto;
    min-height: 44px;
}

.symbol-item:hover,
.kaomoji-item:hover {
    border-color: transparent;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), inset 0 0 10px rgba(212, 0, 255, 0.2);
    color: #fff;
    transform: translateY(-4px) scale(1.05);
    background-image: linear-gradient(#050505, #050505), linear-gradient(45deg, var(--accent-color), var(--secondary-accent));
    background-origin: border-box;
    background-clip: content-box, border-box;
}

/* Materials */
.material-gallery {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.material-item {
    height: 120px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s;
}

.material-item:hover {
    transform: scale(1.02);
    border-color: var(--secondary-accent);
}

.material-preview {
    width: 100%;
    height: 100%;
}

/* Pagination & Controls */
.controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.controls.bottom {
    justify-content: center;
    margin-top: 30px;
}

.pagination-controls {
    display: none;
    justify-content: center;
    gap: 20px;
    align-items: center;
    margin: 20px 0;
}

.nav-btn,
.cat-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 6px 16px;
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-left: 8px;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.nav-btn::before,
.cat-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nav-btn:hover::before,
.cat-btn:hover::before {
    left: 100%;
}

.cat-btn {
    margin: 0 5px 10px 0;
}

.kaomoji-categories {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
}

.nav-btn:hover,
.cat-btn:hover,
.cat-btn.active {
    background: rgba(0, 255, 255, 0.15);
    border-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 0 15px var(--accent-color);
    text-shadow: 0 0 5px var(--accent-color);
}

.page-info {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin: 0 15px;
    align-self: center;
    color: #888;
}

/* Footer */
footer {
    padding: 40px 20px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.8);
    margin-top: 50px;
}

.footer-content p {
    margin: 0;
    color: #555;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 12px 24px;
    border-radius: 2px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 2000;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast::before {
    content: '✓';
    font-weight: bold;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    h1.glitch {
        font-size: 2rem;
    }

    .hero-section {
        padding-top: 40px;
    }

    .glass-header {
        padding: 0 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    nav ul {
        gap: 1rem;
    }

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