:root {
    --primary-green: #2a9d8f;
    --light-green: #8acb88;
    --dark-green: #1d6359;
    --leaf-green: #5e8c61;
    --soft-red: #e76f51;
    --dark-red: #bc4b3e;
    --black: #0d0d0d;
    --dark-bg: #0a1715;
    --light-text: #f0f7f4;
    --gold: #e9c46a;
    --transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    height: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    height: 100%;
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--dark-bg);
    color: var(--light-text);
    line-height: 1.8;
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(42, 157, 143, 0.1) 0%, rgba(42, 157, 143, 0) 20%),
        radial-gradient(circle at 90% 80%, rgba(42, 157, 143, 0.1) 0%, rgba(42, 157, 143, 0) 20%);
    line-height: 1.8;
    font-size: 18px;
}

a,
a:link,
a:visited,
a:hover,
a:active {
    color: inherit;
    text-decoration: none;
}

.nature-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    opacity: 0.2;
}

.nature-element {
    position: absolute;
    opacity: 0.3;
    background-repeat: no-repeat;
    background-size: contain;
    z-index: -1;
}

.leaf-1 {
    width: 150px;
    height: 150px;
    top: 10%;
    left: 5%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50,15 C65,5 85,10 90,25 C95,40 85,60 70,70 C55,80 30,75 20,60 C10,45 15,25 30,15 C35,10 45,10 50,15 Z" fill="%232a9d8f"/></svg>');
    animation: float 12s ease-in-out infinite;
}

.leaf-2 {
    width: 100px;
    height: 100px;
    top: 30%;
    right: 10%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50,20 C40,10 20,15 15,30 C10,45 20,65 35,75 C50,85 75,80 85,65 C95,50 90,30 75,20 C65,15 55,15 50,20 Z" fill="%238acb88"/></svg>');
    animation: float 8s ease-in-out infinite reverse;
}

.leaf-3 {
    width: 120px;
    height: 120px;
    bottom: 20%;
    left: 15%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path d="M50,10 C60,5 80,10 85,25 C90,40 80,60 65,70 C50,80 25,75 15,60 C5,45 10,25 25,15 C35,10 45,10 50,10 Z" fill="%235e8c61"/></svg>');
    animation: float 10s ease-in-out infinite;
}

.red-element {
    width: 80px;
    height: 80px;
    bottom: 10%;
    right: 10%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="%23e76f51"/></svg>');
    animation: pulse 4s ease-in-out infinite;
}

/* 主容器 */
.container {
    width: 80%;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

/* 導航欄 */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 23, 21, 0.95);
    backdrop-filter: blur(5px);
    z-index: 1000;
    padding: 15px 0;
    border-bottom: 1px solid var(--primary-green);
    box-shadow: 0 0 15px rgba(42, 157, 143, 0.3);
    transition: var(--transition);
}

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

.logo {
    display: flex;
    align-items: center;
    font-family: 'cwTeXYen', sans-serif;
    font-size: 26px;
    color: var(--light-green);
    text-shadow: 0 0 10px rgba(138, 203, 136, 0.5);
}

/* 主標題區 */
.hero {
    position: relative;
    flex-grow: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 50px;
    overflow: hidden;
    background: rgba(30, 40, 38, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(42, 157, 143, 0.3);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    padding: 140px 40px 40px 40px; 
    border-radius: 15px;
    transition: var(--transition);
}

.hero-title {
    font-family: 'cwTeXYen', sans-serif;
    font-size: 3.8rem;
    margin-bottom: 20px;
    line-height: 1.1;
    color: var(--light-green);
    text-shadow: 0 0 15px rgba(138, 203, 136, 0.5);
    background: linear-gradient(to right, var(--light-green), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.4rem;
    margin-bottom: 30px;
    color: var(--light-text);
    max-width: 500px;
    font-weight: 300;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(45deg, var(--dark-green), var(--primary-green));
    color: white;
    padding: 15px 40px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: var(--transition);
    border: 2px solid var(--soft-red);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.132);
    position: relative;
    overflow: hidden;
    z-index: 10; /* Ensure button is on top */
}

.cta-container:hover .cta-button {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 223, 186, 0.4);
}

.cta-button:hover {
    background: linear-gradient(45deg, var(--primary-green), var(--light-green));
}

.cta-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20px;
    height: 200%;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
    transition: var(--transition);
}

.cta-button:hover::after {
    left: 120%;
}

.character-gallery {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.character-img {
    position: absolute;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--soft-red);

    transition: var(--transition);
    max-width: 280px;
    filter: drop-shadow(0 0 15px rgba(42, 157, 143, 0.7));
}

.character-img:hover {
    transform: scale(1.05);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    z-index: 10;
}

.img-1 {
    top: 15%;
    right: 5%;
    width: 250px;
    animation-duration: 12s;
}

.img-2 {
    top: 50%;
    right: 20%;
    width: 220px;
    animation-duration: 10s;
    animation-delay: 1s;
}

.img-3 {
    top: 30%;
    right: 35%;
    width: 200px;
    animation-duration: 14s;
    animation-delay: 2s;
}

/* 頁腳 */
footer {
    background: rgba(8, 20, 18, 0.95);
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 0; /* Let padding control height */
    flex-shrink: 0; /* Prevent footer from shrinking */
}

.contact{
    padding: 0px 0 20px;
}

.copyright {
    color: rgba(240, 247, 244, 0.6);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* 滾動可見動畫 */
.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Combined animation for floating images */
.character-img.visible {
    animation: float-in 8s ease-in-out infinite;
}

@keyframes float-in {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    10% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0);
    }
}

/* CTA 抽屜按鈕 */
.cta-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-top: 20px;
}

.cta-drawer {
    display: flex;
    align-items: center; /* Vertically center buttons */
    background: rgba(29, 99, 89, 0.9);
    backdrop-filter: blur(3px);
    border-radius: 30px;
    margin-left: -40px; /* Increase overlap */
    padding-left: 45px; /* Increase padding */
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, padding-left 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.3s ease;
    white-space: nowrap;
    z-index: 5; /* Below the main button */
}

.cta-container:hover .cta-drawer {
    max-width: 300px; /* adjust as needed */
    opacity: 1;
    transform: translateY(-5px); /* Match start button's hover effect */
}

.drawer-btn {
    background: transparent;
    border: none;
    color: var(--light-text);
    font-family: 'Noto Sans TC', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s; /* Removed transform */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.drawer-btn:hover {
    color: var(--gold);
    background-color: rgba(255, 255, 255, 0.25);
}

/* --- RESPONSIVE DESIGN --- */

/* Hide mobile-specific buttons on desktop by default */
.mobile-buttons {
    display: none;
}

/* --- RESPONSIVE DESIGN --- */

/* 1. Large Tablet Layout */
@media (min-width: 901px) and (max-width: 1120px) {
    /* Rearrange content to prevent overlap on smaller screens */
    .hero-content {
        padding: 30px;
        margin: 20px auto 0;
        max-width: 90%;
        text-align: center;
        flex-shrink: 0;
        background: rgba(10, 23, 21, 0.6);
        backdrop-filter: blur(1px);
        -webkit-backdrop-filter: blur(1px);
        border-radius: 15px;
        border: none; /* Removed border as requested */
        box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    }

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

    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }

    /* Move images to the bottom */
    .character-gallery {
        position: absolute;
        bottom: 20px;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        gap: 15px;
        padding: 0 15px;
    }

    .character-img {
        position: static;
        width: clamp(120px, 18vw, 160px);
        animation: none; /* Disable complex floating animations */
        transition: transform 0.3s ease; /* Add simple hover effect */
    }
    
    .character-img:hover {
        transform: scale(1.05) translateY(-5px);
    }

    /* Disable JS-driven animations */
    .character-img.visible {
       animation: none;
       opacity: 1;
       transform: none;
    }
}

/* 2. Small Tablet Layout */
@media (min-width: 769px) and (max-width: 900px) {
    .hero-content {
        max-width: 100%;
        text-align: center;
        padding: 40px 20px;
        margin: 0 auto;
    }
    
    .character-gallery {
        display: none;
    }
    
    .character-content {
        flex-direction: column;
    }
    
    .character-text, .character-image {
        width: 100%;
    }
    
    .section-title {
        font-size: 2.4rem;
    }
    
    .platform-cards {
        flex-direction: column;
        align-items: center;
    }
}

/* 3. Mobile Layout - Final Corrected Version */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow: hidden; /* Prevent scrolling on the body */
    }

    .hero {
        height: 100%; /* Make hero take full available height */
        padding: 20px 20px 100px 20px; /* Add padding to prevent content from being hidden by the fixed footer */
        box-sizing: border-box;
        overflow-y: auto; /* Allow hero content to scroll */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .hero .container {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .hero-content {
        width: 100%;
        max-width: 500px;
        background: rgba(255, 255, 255, 0);
        backdrop-filter: blur(0.5px);
        -webkit-backdrop-filter: blur(0.5px);
        border-radius: 15px;
        border: none;
        padding: 30px;
        box-sizing: border-box;
        text-align: left;
    }

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

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
        font-weight: 300;
    }

    /* --- Button & Element Visibility --- */

    .cta-container {
        display: block;
        width: 280px; /* Set a fixed width on the container */
        max-width: 100%;
        margin-top: 30px;
    }

    /* Hide elements not for mobile */
    .character-gallery,
    .cta-drawer {
        display: none !important;
    }

    /* Minimalist button design */
    .cta-container .cta-button {
        display: block;
        width: 100%;
        box-sizing: border-box;
        background: none;
        border: none;
        padding: 12px 0 12px 25px; /* Top, Right, Bottom, Left */
        font-weight: 700;
        color: var(--light-text);
        text-align: left;
        position: relative;
        border-radius: 8px;
        transition: background-color 0.2s ease, transform 0.2s ease;
    }

    /* The '›' symbol */
    .cta-container .cta-button::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        font-weight: 900;
        transition: left 0.3s ease;
    }

    /* Hover effect */
    .cta-container .cta-button:hover {
        padding-left: 30px; /* Move text slightly on hover */
        background: none; /* Explicitly remove background */
        transform: none;
        box-shadow: none;
    }

    .cta-container .cta-button:hover::before {
        left: 5px; /* Move arrow slightly on hover */
    }

    /* Spacing between buttons */
    #start-btn {
        margin-bottom: 15px;
    }

    .mobile-buttons {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    /* --- Footer --- */
    footer {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px; /* A sensible max-width for mobile */
        padding: 12px 20px;
        box-sizing: border-box;
        text-align: center;
        background-color: rgba(255, 255, 255, 0);
        border-radius: 15px;
        box-shadow: 0 4px 20px rgba(255, 255, 255, 0.168);
        z-index: 1001;
        /* The original animation might interfere, so we reset it */
        opacity: 1;
        transform: translateX(-50%) translateY(0);
        transition: none;
    }

    .footer-links {
        margin-bottom: 8px;
    }

    /* Override scroll animation for the fixed footer's content */
    footer .copyright.scroll-animate {
        opacity: 1;
        transform: none;
    }

    /* Disable the reflection animation on mobile buttons */
    .cta-button::after {
        display: none;
    }
}


/* Modal 彈窗樣式 */
.modal {
    display: none; /* Initially hidden */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 0; /* Start transparent */
    transition: opacity 0.5s ease; /* Animate opacity */
    pointer-events: none; /* Prevent interaction when hidden */
}

.modal[style*="display: flex"] {
    pointer-events: auto; /* Allow interaction when shown */
}

.modal.visible {
    opacity: 1;
}

.modal-content {
    background: var(--dark-bg);
    border: 1px solid var(--primary-green);
    padding: 40px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.5s var(--transition);
}

.modal.visible .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    color: var(--light-green);
    margin-bottom: 30px;
    font-family: 'ZCOOL QingKe HuangYou', sans-serif;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover, .close-btn:focus {
    color: var(--soft-red);
}

/* "使用" 彈窗樣式 */
.qr-codes {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.qr-code-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-code-item i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary-green);
}

.qr-code-item h3 {
    margin-bottom: 15px;
}

.qr-code-item img {
    width: 150px;
    height: 150px;
    border: 3px solid var(--dark-green);
    border-radius: 10px;
}

/* "模組" 彈窗樣式 */
.module-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.module-card {
    background: rgba(30, 40, 38, 0.7);
    border: 1px solid var(--dark-green);
    border-radius: 10px;
    padding: 25px;
    text-decoration: none;
    color: var(--light-text);
    transition: var(--transition);
}

.module-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-green);
    box-shadow: 0 5px 20px rgba(42, 157, 143, 0.2);
}

.module-card h3 {
    color: var(--light-green);
    margin-bottom: 10px;
}

/* 動畫效果 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
    100% { transform: scale(1); opacity: 0.3; }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 2.8rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .feature-card {
        padding: 25px 20px;
    }
    
    .feature-title {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 2.0rem;
    }
    
    .character-title {
        font-size: 2.2rem;
    }
    
    .footer-title {
        font-size: 2.0rem;
    }
    
    body {
        font-size: 16px;
    }
}