:root {
    --bg-color: #050505;
    --card-bg: rgba(20, 20, 25, 0.85);
    --primary: #00e6ff;
    --secondary: #7000ff;
    --text-main: #ffffff;
    --text-muted: #a8a8b3;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
}

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

body {
    font-family: 'Noto Sans TC', 'Inter', system-ui, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s;
}

a:hover {
    color: var(--primary);
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -3;
    background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 60px 60px;
}

.particles, .hero-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: radial-gradient(circle at 30% 70%, rgba(0, 230, 255, .15) 0%, transparent 50%), radial-gradient(circle at 80% 30%, rgba(112, 0, 255, .15) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-30px); }
}

nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5, 5, 5, .9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 230, 255, .2);
}

.logo svg {
    display: block;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-weight: 600;
    position: relative;
    color: var(--text-muted);
    padding: 8px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--gradient);
    border-radius: 3px;
    transition: .4s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
}

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

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
    transition: .3s;
}

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

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

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

.cta-btn {
    padding: 12px 28px;
    border: 1.5px solid var(--primary);
    border-radius: 12px;
    background: transparent;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    transition: all .4s;
    position: relative;
    overflow: hidden;
}

.cta-btn.filled {
    background: var(--gradient);
    color: #fff;
    border: none;
    box-shadow: 0 0 30px rgba(0, 230, 255, .6);
    padding: 16px 36px;
    font-size: 1.1rem;
}

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

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

.cta-btn.filled:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 0 50px rgba(0, 230, 255, .9);
}

/* Case Studies 特定 CTA 按鈕優化（避免跑版） */
.cta-case-btn {
    margin-top: clamp(20px, 5vw, 40px);
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    padding: clamp(16px, 4vw, 22px) clamp(20px, 8vw, 60px);
    display: inline-block; /* 確保不全寬，除非媒體查詢 */
}

/* Hero 優化 */
.hero {
    text-align: center;
    padding: clamp(100px, 15vw, 160px) 5% clamp(80px, 10vw, 120px);
    position: relative;
    z-index: 1;
}

.hero.small {
    padding: clamp(80px, 12vw, 140px) 5% clamp(60px, 8vw, 100px);
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.6rem);
    font-weight: 900;
    background: linear-gradient(135deg, #fff, #00e6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    max-width: 900px;
    margin: 0 auto 50px;
    opacity: .9;
    line-height: 1.6;
}

/* Section 優化 */
.section {
    padding: clamp(60px, 8vw, 100px) 5%;
    max-width: 1300px;
    margin: 0 auto;
}

.section-title {
    font-size: clamp(2rem, 4vw, 2.6rem);
    text-align: center;
    margin-bottom: clamp(40px, 6vw, 70px);
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    font-size: 1.2rem;
    text-align: center;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 50px;
}

/* 網格優化 */
.card-grid, .dashboard-grid, .key-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(280px, 25vw, 340px), 1fr));
    gap: clamp(20px, 3vw, 30px);
    margin-top: 30px;
}

@media (max-width: 1024px) {
    .card-grid, .dashboard-grid, .key-stats {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .card-grid, .dashboard-grid, .key-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ROI 計算器優化 */
.roi-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.roi-calculator {
    background: var(--card-bg);
    padding: clamp(40px, 6vw, 60px);
    border-radius: 24px;
    border: 2px solid var(--primary);
    box-shadow: 0 0 80px rgba(0, 230, 255, .2);
    backdrop-filter: blur(10px);
}

.input-group {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group label {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.slider {
    flex: 1;
    min-width: 280px;
    height: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient);
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 230, 255, 0.8);
}

.slider-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #00e6ff;
    min-width: 160px;
    text-align: right;
}

.result-box {
    margin-top: 50px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    border: 2px solid #00e6ff;
    text-align: center;
}

.result-label {
    font-size: 1.3rem;
    color: #aaa;
    margin-bottom: 15px;
}

.result-number {
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 卡片 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(280px, 25vw, 340px), 1fr));
    gap: 30px;
}

.card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, .1);
    transition: all .5s;
    backdrop-filter: blur(12px);
    text-decoration: none;
}

.card:hover {
    transform: translateY(-20px) scale(1.03);
    box-shadow: 0 30px 60px rgba(0, 230, 255, .25);
    border-color: var(--primary);
}

.stat {
    margin-top: 20px;
    color: var(--primary);
    font-weight: 700;
}

.live-stats {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(0, 0, 0, .5);
    padding: 20px;
    border-radius: 12px;
    display: inline-block;
}

.stat-box {
    background: rgba(255, 255, 255, .05);
    padding: 28px;
    border-radius: 16px;
    border-left: 5px solid var(--primary);
    backdrop-filter: blur(10px);
    transition: .4s;
}

.stat-box:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 230, 255, .15);
}

.stat-box h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

/* 圖表容器優化 */
.chart-container {
    background: rgba(20, 20, 25, .8);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(0, 230, 255, .2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .3);
    margin: 40px 0;
    aspect-ratio: 16 / 9; /* 維持比例 */
    position: relative;
}

.chart-container canvas {
    max-height: 100%;
}

/* 案例卡片 */
.case-studies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.case-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    transition: all .5s;
}

.case-card:hover {
    transform: translateY(-20px);
    box-shadow: 0 30px 60px rgba(0, 230, 255, .25);
}

.case-image {
    height: 240px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.case-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 50%, rgba(5, 5, 5, .9));
}

.case-content {
    padding: 30px;
}

.case-stat {
    font-size: 2.2rem;
    font-weight: 900;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 15px 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* 使用 gap 取代 margin-right，避免累積溢出 */
    margin-top: 15px;
}

.tags span {
    display: inline-block;
    background: rgba(0, 230, 255, .15);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: .9rem;
    transition: .3s;
    white-space: nowrap; /* 防止文字換行 */
}

.tags span:hover {
    background: var(--primary);
    color: #000;
    transform: translateY(-3px);
}

/* Split Content */
.split-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}

@media (max-width: 768px) {
    .split-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

/* 行動端優化 */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    .nav-links {
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        background: rgba(5, 5, 5, .98);
        flex-direction: column;
        padding: 40px 0;
        transform: translateY(-120%);
        transition: transform 0.4s ease;
        text-align: center;
        z-index: 999;
    }
    .nav-links.active {
        transform: translateY(0);
    }
    .nav-links a {
        margin: 20px 0;
        font-size: 1.3rem;
    }
    nav .cta-btn {
        display: none;
    }

    .roi-calculator {
        padding: 40px 25px;
    }
    .slider-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    .slider {
        min-width: auto;
    }
    .slider-value {
        text-align: left;
    }
    .result-number {
        font-size: 3.5rem;
    }

    .hero-cta {
        flex-direction: column;
        gap: 20px;
    }
    .cta-btn {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    /* Case Studies 按鈕跑版修正 */
    .section .cta-btn.filled.cta-case-btn {
        width: 100%;
        max-width: 100%;
        padding: clamp(16px, 4vw, 22px) clamp(20px, 8vw, 60px);
        font-size: clamp(1.1rem, 3vw, 1.4rem);
        margin-top: clamp(20px, 5vw, 40px);
        box-sizing: border-box;
    }

    .section[style*="background:linear-gradient"] {
        padding: clamp(80px, 12vw, 140px) 5%;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 40px 5%;
    }
    .chart-container {
        padding: 20px;
        margin: 20px 0;
    }
    .case-studies-grid {
        grid-template-columns: 1fr;
    }

    /* 極小螢幕按鈕修正 */
    .section .cta-btn.filled.cta-case-btn {
        padding: 18px 30px;
        font-size: 1.2rem;
    }

    /* Tags 跑版修正：垂直堆疊，縮小 padding */
    .tags {
        flex-direction: column;
        gap: 6px;
        align-items: flex-start; /* 左對齊 */
    }

    .tags span {
        padding: 6px 12px;
        font-size: 0.8rem;
        width: 100%; /* 全寬，避免水平溢出 */
        text-align: center;
    }
}

/* Footer 居中修正 */
footer {
    padding: clamp(40px, 8vw, 80px) 5%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, .1);
    gap: 15px; /* logo 與文字間距 */
}

footer .logo {
    display: flex;
    justify-content: center;
    width: 100%;
}

footer .logo svg {
    margin-bottom: 0; /* 移除固定 margin，使用 gap 控制 */
}

footer small {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 100%;
    word-break: break-word; /* 防止長文字溢出 */
}

@media (max-width: 768px) {
    footer {
        padding: 40px 5%;
        gap: 10px;
    }
    
    footer small {
        font-size: 0.8rem;
        padding: 0 10px; /* 行動端邊距 */
    }
}

/* 動畫 */
.animate-in {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

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

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
