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

html {
    overflow-x: hidden;
    width: 100%;
}

html,
body {
    max-width: 100%;
}

:root {
    --primary-cyan: #a5f4f3;
    --primary-gold: #ffd900;
    --primary-blue: #6dceff;
    --accent-teal: #06ffa5;
    --dark-bg: #0a0a0a;
    --dark-overlay: rgba(10, 10, 10, 0.7);
    --dark-secondary: rgba(20, 20, 20, 0.95);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #6dceff;
    --text-secondary: #ffffff;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--dark-bg);
    color: var(--primary-gold);
    overflow-x: hidden;
    line-height: 1.6;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url(media/background.jpg);
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    z-index: -3;
    animation: backgroundZoomOut 3s ease-out forwards;
    transform-origin: center center;
    transform: scale(1.1);
}

/* 粒子背景 */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
}

/* 自定義游標 */
* {
    cursor: none;
}

.cursor {
    position: fixed;
    width: 36px;
    height: 36px;
    background-image: url('media/cursor/short.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    z-index: 10000;
    transition: transform 0.1s ease-out, opacity 0.2s ease-in-out;
    opacity: 0;
}

.cursor-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.05s linear;
}

.cursor-img.active {
    opacity: 1;
}

.cursor-follower {
    position: fixed;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(165, 244, 243, 0.15);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: all 0.3s ease-out, opacity 0.2s ease-in-out;
    opacity: 0;
}

.cursor.expand {
    transform: scale(1.3);
}

.cursor-follower.expand {
    transform: scale(1.4);
    opacity: 0.25;
    border-color: rgba(165, 244, 243, 0.25);
}

/* 移動端隱藏自定義游標和禁用 3D 效果 */
@media (max-width: 768px) {
    * {
        cursor: auto;
    }

    .cursor,
    .cursor-follower {
        display: none;
    }

    /* 完全禁用 3D transform 相關屬性 */
    * {
        transform-style: flat !important;
        perspective: none !important;
    }

    /* 手機版強制隱藏滾動條 */
    html,
    body {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none !important;
        /* Firefox */
        -ms-overflow-style: none !important;
        /* IE and Edge */
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar,
    *::-webkit-scrollbar {
        display: none !important;
        /* Chrome, Safari and Opera */
        width: 0 !important;
        height: 0 !important;
    }

    /* 強制所有容器隱藏滾動條 */
    * {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    *::-webkit-scrollbar {
        display: none !important;
    }
}

/* 觸摸設備專用樣式 */
@media (hover: none) and (pointer: coarse) {

    .experience-card,
    .about-cards .card,
    .anime-wrapper .card {
        transform: none !important;
        transition: transform 0.3s ease, box-shadow 0.3s ease !important;
    }

    .experience-card:active,
    .about-cards .card:active,
    .anime-wrapper .card:active {
        transform: scale(0.98) !important;
    }
}

/* 背景縮小動畫 */
@keyframes backgroundZoomOut {
    from {
        transform: scale(1.1);
    }

    to {
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    body::before {
        height: 100vh;
        height: -webkit-fill-available;
        min-height: 100vh;
        min-height: -webkit-fill-available;
        position: fixed;
        background-position: center center;
        background-size: cover;
        background-attachment: scroll;
    }

    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    #hero {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

@supports (-webkit-touch-callout: none) {
    body::before {
        height: -webkit-fill-available;
    }
}

nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--glass-border);
}

nav.scrolled {
    background: rgba(10, 10, 10, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.navbar .navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-cyan);
    text-decoration: none;
    text-shadow: 0 0 20px rgba(0, 180, 216, 0.5);
}

.navbar .navbar-brand:hover,
.navbar .navbar-brand:focus {
    color: var(--primary-cyan) !important;
}

a.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
}

a.nav-link:hover {
    color: var(--text-primary);
}

a.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-cyan);
    transition: width 0.3s ease;
}

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

#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    background: linear-gradient(to bottom, transparent 0%, var(--dark-overlay) 150%);
    padding-top: 70px;
    box-sizing: border-box;
}

.hero-content {
    text-align: center;
    z-index: 1;
    position: relative;
    animation: fadeInUp 1s ease-out;
    margin-top: 0;
    transform: translateY(-20px);
}

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

    to {
        opacity: 1;
        transform: translateY(-20px);
    }
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
    letter-spacing: -2px;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 300;
    letter-spacing: 1px;
}

.hero-description {
    max-width: 600px;
    margin: 0 auto;
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.1rem;
}

/* Hero 區塊手機版優化 */
@media (max-width: 768px) {
    #hero {
        min-height: 100svh;
        padding: 60px 0 0 0;
        /* 調整 padding，60px 給導航列 */
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }

    .hero-content {
        padding: 0 20px;
        text-align: center;
        transform: translateY(-10px);
        /* 手機版較小的偏移 */
    }

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

        to {
            opacity: 1;
            transform: translateY(-10px);
            /* 手機版動畫結束位置 */
        }
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.3;
        margin-bottom: 1rem;
        letter-spacing: -1px;
        word-break: keep-all;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        line-height: 1.8;
        letter-spacing: 0;
    }

    .hero-description {
        font-size: 0.95rem;
        line-height: 1.7;
        padding: 0 10px;
        max-width: 100%;
    }

    body::before {
        background-position: center center;
        background-size: cover;
    }

    #hero {
        background: linear-gradient(to bottom,
                rgba(10, 10, 10, 0.3) 0%,
                rgba(10, 10, 10, 0.5) 50%,
                var(--dark-overlay) 100%);
    }
}

/* 超小型手機調整 */
@media (max-width: 380px) {
    #hero {
        padding-top: 55px;
        /* 更小的導航列高度 */
    }

    .hero-content {
        transform: translateY(-5px);
        /* 更小的偏移 */
    }
}

.section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 100svh;
    padding: 5rem 2rem;
    position: relative;
    background: var(--dark-overlay);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}


/* 手機版固定section高度以防跳動 */
@media (max-width: 768px) {
    .section {
        min-height: 100vh;
        padding: 3rem 1rem;
    }
}

.container {
    max-width: 80vw;
    margin: 0 auto;
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 768px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
}

.section-title {
    font-size: 3rem;
    margin-bottom: 3rem;
    text-align: center;
    font-weight: 700;
    position: relative;
    display: inline-block;
    width: 100%;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--primary-cyan);
    border-radius: 2px;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 180, 216, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.about-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    width: 100%;
}

.about-cards {
    flex: 2;
    min-width: 0;
}

.about-cards .card {
    opacity: 1;
    transform: none;
}

.about-cards h3 {
    color: var(--primary-cyan);
    margin-bottom: 1rem;
    font-weight: 600;
}

.about-cards p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.about-oc {
    flex: 1;
    max-width: 300px;
    min-width: 200px;
    opacity: 1;
    transform: none;
}

.about-oc img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.about-oc div {
    margin-top: 30px;
    margin-left: 5%;
    width: 90%;
    height: 4px;
    background: var(--primary-cyan);
    border-radius: 2px;
}

@media (max-width: 768px) {
    .about-wrapper {
        flex-direction: column;
    }

    .about-oc {
        max-width: 100%;
    }
}


/* 程式經歷 */

.experience-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
    cursor: pointer;
}

.experience-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(0, 180, 216, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.experience-image {
    width: 100%;
    height: 200px;
    background: rgba(0, 180, 216, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.experience-image::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.experience-image img {
    border-radius: 10px;
    max-width: 95%;
    max-height: 95%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.experience-content {
    padding: 1.5rem;
}

.experience-title {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--primary-cyan);
    font-weight: 600;
}

.experience-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    background: rgba(0, 180, 216, 0.1);
    color: var(--primary-cyan);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 180, 216, 0.3);
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: rgba(0, 180, 216, 0.2);
    transform: translateY(-2px);
}

/* 攝影作品 */

.photo-carousel .photo-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.photo-item img {
    display: block;
    width: 100%;
    height: auto;
}

.photo-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.photo-item:hover .overlay {
    opacity: 1;
}

.slick-prev,
.slick-next {
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.photo-carousel {
    position: relative;
}

.photo-carousel .slick-prev,
.photo-carousel .slick-next {
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    z-index: 2;
}

.photo-carousel .slick-prev {
    left: 10px;
}

.photo-carousel .slick-next {
    right: 10px;
}

/* 動漫筆記 */

.anime-wrapper .card {
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.anime-wrapper .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-cyan), var(--primary-blue), var(--accent-teal));
    opacity: 0.7;
}

.anime-wrapper .card:hover {
    transform: translateY(-8px);
    border-color: rgba(165, 244, 243, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

/* 統一的卡片頭部 */
.card-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.card-header h3 {
    color: var(--primary-cyan);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h3 i {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* 統一的卡片內容 */
.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}


/* 最愛動漫卡片 */
.anime-favorites .favorite-list {
    margin-bottom: 1.5rem;
}

.rank-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 4px solid transparent;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.rank-item:nth-child(1) {
    border-left-color: #FFD700;
}

.rank-item:nth-child(2) {
    border-left-color: #C0C0C0;
}

.rank-item:nth-child(3) {
    border-left-color: #CD7F32;
}

.rank-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.favorite-images {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-top: auto;
}

.favorite-images img {
    flex: 1;
    width: 100%;
    max-width: 80px;
    height: 80px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.favorite-images img:hover {
    transform: scale(1.05);
}

/* 偶像卡片 */
.idol-info {
    text-align: center;
}

.idol-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-cyan);
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(165, 244, 243, 0.3);
}

.idol-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.birthday-note {
    background: rgba(165, 244, 243, 0.1);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    color: var(--primary-cyan);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.special-note {
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* 動漫記錄卡片 */
.stats-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(165, 244, 243, 0.05);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-cyan);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    opacity: 0.8;
}

.stat-divider {
    color: var(--primary-cyan);
    opacity: 0.5;
    font-weight: 300;
}

.list-header {
    color: var(--primary-cyan);
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(165, 244, 243, 0.2);
    font-size: 0.9rem;
}

.anime-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-cyan) transparent;
}

.anime-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.anime-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.anime-title {
    display: block;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.anime-extra {
    display: block;
    color: var(--primary-cyan);
    font-size: 0.8rem;
    opacity: 0.7;
    font-weight: 400;
}

/* === 手機版 RWD === */
@media (max-width: 768px) {

    /* 重置所有可能被 3D 效果影響的卡片樣式 */
    .experience-card,
    .about-cards .card,
    .anime-wrapper .card {
        transform: none !important;
        perspective: none !important;
        transform-style: flat !important;
    }

    /* 確保卡片懸停效果在手機版正常 */
    .experience-card:hover,
    .about-cards .card:hover,
    .anime-wrapper .card:hover {
        transform: translateY(-5px) !important;
    }

    .card-header {
        padding: 1rem 1rem 0.75rem;
    }

    .card-content {
        padding: 1rem;
    }

    .stats-summary {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .stats-summary .stat-item {
        flex-direction: row;
        gap: 0.5rem;
    }

    .stat-divider {
        display: none;
    }

    .favorite-images {
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
    }

    .favorite-images img {
        flex: none;
        width: 60px;
        height: 60px;
        max-width: 60px;
    }

    .idol-name {
        font-size: 1.5rem;
    }

    .anime-list {
        max-height: 200px;
    }
}

/* Blog 區塊 */
.blog-link {
    display: inline-block;
    background: var(--primary-cyan);
    color: var(--text-primary);
    padding: 1rem 2.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

.blog-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-blue);
    transition: left 0.3s ease;
}

.blog-link:hover::before {
    left: 0;
}

.blog-link span {
    position: relative;
    z-index: 1;
}

.blog-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 180, 216, 0.4);
}


/* 響應式設計 */
@media (max-width: 768px) {
    /* .nav-links {
        display: none;
    } */

    .hero-title {
        font-size: 2.5rem;
    }

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

    .experience-grid,
    .anime-grid {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 3rem 1rem;
    }
}

/* 滾動動畫增強 */
[data-aos] {
    transition-property: transform, opacity !important;
}

/* 自定義滾動條 */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-cyan);
    border-radius: 5px;
}

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