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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "M PLUS 1", sans-serif;
    font-style: normal;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    background-color: #ffffff;
    min-height: 100vh;
}

.hamburger {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    opacity: 0;
    transform: translateY(-50px);
    transition: all 0.3s ease;
}

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

.hamburger-btn {
    background: linear-gradient(135deg, #9c67d1 0%, #98efed 100%);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.hamburger-btn span {
    width: 20px;
    height: 2px;
    background: white;
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

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

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(3.2px, -3.2px);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(156, 103, 209, 0.9) 0%, rgba(152, 239, 237, 0.9) 100%);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.overlay-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.overlay-close:hover {
    transform: rotate(90deg);
    opacity: 0.8;
}

.overlay nav a {
    display: block;
    color: white;
    text-decoration: none;
    font-size: 2rem;
    margin: 20px 0;
    padding: 10px 30px;
    border: 2px solid transparent;
    border-radius: 50px;
    transition: all 0.3s ease;
    transform: translateY(50px);
    opacity: 0;
    font-family: "BBH Bartle", sans-serif;
    font-style: normal;   
}

.overlay.active nav a {
    transform: translateY(0);
    opacity: 1;
}

.overlay nav a:nth-child(1) { transition-delay: 0.1s; }
.overlay nav a:nth-child(2) { transition-delay: 0.2s; }
.overlay nav a:nth-child(3) { transition-delay: 0.3s; }
.overlay nav a:nth-child(4) { transition-delay: 0.4s; }
.overlay nav a:nth-child(5) { transition-delay: 0.5s; }

.overlay nav a:hover {
    border-color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.illust-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 40px 60px;
    background-color:#ffffff;
    background-image:url(top_backimage/back2.png) ;
    animation: bgiLoop 20s linear infinite;
}

@keyframes bgiLoop {
    0% { background-position: 0 0;}
  100% { background-position: -1000px 1000px;}
}

.content-wrapper {
    max-width: 1200px;
    width: 100%;
    animation: fadeIn 0.8s ease;
}

.content-wrapper h1 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 40px;
    color: #2accbb;
    font-family: "BBH Bartle", sans-serif;
    font-style: normal;   
    text-shadow:2px 2px 0 #FFF, -2px -2px 0 #FFF,
                -2px 2px 0 #FFF, 2px -2px 0 #FFF,
                0px 2px 0 #FFF,  0-2px 0 #FFF,
                -2px 0 0 #FFF, 2px 0 0 #FFF;
}

.folder-container {
    position: relative;
    margin-bottom: 40px;
}

.folder-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.folder-tab {
    background: #ffffff;
    border: 3px solid #b5f3f0;
    border-radius: 10px;
    padding: 12px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    font-weight: bold;
    color: #b5f3f0;
    font-family: "BBH Bartle", sans-serif;
    font-style: normal;
}

.folder-tab:hover:not(.active) {
    background: #ffffff;
    border-color: #fbca1b;
}

.folder-tab.active {
    background: #ffffff;
    border-color: #2accbb;
    color: #fbca1b;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.folder-content {
    background: #ffffff;
    border: 3px solid #2accbb;
    border-radius: 15px;
    padding: 40px;
    min-height: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    min-height: 400px;
}

.gallery-item {
    aspect-ratio: 1;
    cursor: pointer;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #666;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
    color: #333;
}

.gallery-item[data-src] {
    background-size: cover;
    background-position: center;
}

.gallery-item[data-src] span {
    display: none;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal img {
    max-width: 70%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-caption {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: normal;
    z-index: 1001;
    max-width: 600px;
    text-align: center;
    word-wrap: break-word;
    display: none;
}

.modal-caption.active {
    display: block;
}

.modal-close,
.modal-prev,
.modal-next {
    position: fixed;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.modal-close {
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
}

.modal-prev,
.modal-next {
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
}

.modal-prev {
    left: calc((100% - 70%) / 2 - 80px);
}

.modal-next {
    right: calc((100% - 70%) / 2 - 80px);
}

.modal-close:hover,
.modal-prev:hover,
.modal-next:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.modal-close:hover {
    transform: scale(1.1);
}

.portal-btn {
    display: block;
    width: fit-content;
    margin: 0 auto;
    background: linear-gradient(135deg, #9c67d1 0%, #98efed 100%);
    color: white;
    text-decoration: none;
    padding: 15px 50px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: "BBH Bartle", sans-serif;
    font-style: normal;   
}

.portal-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 ease;
}

.portal-btn:hover::before {
    left: 100%;
}

.portal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

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

@media (max-width: 768px) {
    .illust-page {
        padding: 80px 20px 40px;
    }
    
    .content-wrapper h1 {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .folder-tabs {
        flex-wrap: wrap;
    }
    
    .folder-tab {
        flex: 1 1 auto;
        min-width: 100px;
        font-size: 1rem;
        padding: 10px 20px;
    }
    
    .folder-content {
        padding: 25px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .external-links {
        padding: 25px;
    }
    
    .overlay nav a {
        font-size: 1.5rem;
    }
    
    .modal-prev {
        left: -60px;
    }
    
    .modal-next {
        right: -60px;
    }
    
    .modal-close {
        top: -40px;
        right: -40px;
    }
    
    .modal-caption {
        left: 20px;
        font-size: 0.9rem;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .folder-tabs {
        gap: 8px;
    }
    
    .folder-tab {
        flex: 1 1 calc((100% - 16px) / 3);
        font-size: 0.5rem;
        padding: 10px 5px;
        min-width: 0;
        word-break: break-all;
    }
    
    .folder-content {
        padding: 20px;
        min-height: calc(100vw + 40px);
        height: auto;
        display: flex;
        align-items: center;
        overflow: hidden;
    }
    
    .tab-content {
        width: 100%;
    }
    
    .gallery-grid { 
        display: flex;
        grid-template-columns: unset;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 20px;
        padding-left: 20px;
        padding-right: 20px;
        margin: 0 -20px 0 0;
        min-height: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .gallery-grid::-webkit-scrollbar {
        display: none;
    }
    
    .gallery-item {
        flex-shrink: 0;
        width: 70vw;
        height: auto;
        aspect-ratio: 0.7 !important;
        scroll-snap-align: start;
        box-shadow: none;
    }
    
    .gallery-item:hover {
        transform: none;
        box-shadow: none;
    }

    .link-grid {
        flex-direction: row;
        justify-content: center;
        align-items: stretch;
        gap: 15px;
    }
    
    .external-link {
        width: calc((100% - 30px) / 3);
        height: auto;
        aspect-ratio: 1;
        flex-shrink: 0;
    }
    
    .external-link img {
        width: 50%;
        height: 50%;
    }
    
    .external-link span {
        font-size: 0.8rem;
    }
    
    .modal-prev, .modal-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
        left: 10px;
    }
    
    .modal-next {
        left: auto;
        right: 10px;
    }
    
    .modal-close {
        top: 20px;
        right: 20px;
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .modal-caption {
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.8rem;
        max-width: 80%;
        padding: 8px 15px;
        white-space: nowrap !important;
    }
}