@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #edbe5a; /* Hytale 金色 */
    --accent: #4ade80;  /* 森林綠 */
    --bg: #0a0a0c;      /* 補上背景色變數 */
    --card-bg: rgba(20, 20, 25, 0.8); /* 補上卡片背景變數 */
}

body {
    background-color: var(--bg);
    color: white;
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
}

.hytale-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 120vh;
    z-index: -1;
    background-image: url('img/index_1.png');
    background-size: cover;
    background-position: center center;
    filter: brightness(0.6); 
}

/* 導覽列 */
nav {
    position: fixed;
    top: 0; width: 100%;
    padding: 25px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
}

.logo { font-weight: 900; font-size: 1.5rem; letter-spacing: 2px; color: white; }
.logo span { color: var(--primary); display: block; font-size: 0.9rem; letter-spacing: 1px;}
.nav-links a { color: white; text-decoration: none; margin-left: 30px; font-size: 0.9rem; transition: 0.3s; font-weight: 700;}
.nav-links a:hover { color: var(--primary); }
.btn-sm { background: var(--primary); padding: 8px 20px; border-radius: 4px; color: black !important;}

/* 英雄區塊 */
section { min-height: 100vh; width: 100%; position: relative; }

/* 英雄區塊內容置中 */
.content {
    padding: 30vh 20px;       /* 增加上下間距 */
    max-width: 1000px;        /* 稍微加寬，讓標題更有氣勢 */
    margin: 0 auto;           /* 容器水平置中 */
    text-align: center;       /* 文字水平置中 */
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;      /* 確保 Flex 子元素也置中 */
}

.tag { color: var(--accent); font-weight: bold; text-transform: uppercase; letter-spacing: 3px; font-size: 0.9rem; display: inline-block; margin-bottom: 15px; background: rgba(0,0,0,0.3); padding: 5px 10px; border-radius: 4px;}
/* 標題強化：加上一點聖誕金光感 */
h1 {
    font-size: 5.5rem;        /* 稍微放大 */
    margin: 10px 0 30px 0;
    line-height: 1.1;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(237, 190, 90, 0.3); /* 淡淡的金光 */
}
/* 讓描述段落置中並限制寬度，避免字太長難閱讀 */
p {
    font-size: 1.3rem;
    color: #e0e0e0;
    margin: 0 auto 40px auto; /* 核心：水平置中並保持底部間距 */
    line-height: 1.6;
    max-width: 700px;
}

/* 針對按鈕的特別修正 */
.cta-button {
    display: inline-block !important; /* 強制轉為區塊元素 */
    padding: 18px 45px;
    background-color: #edbe5a !important; /* 直接給顏色 */
    color: #000000 !important;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    border-radius: 4px;
    transition: 0.3s ease;
    cursor: pointer;
    visibility: visible !important; /* 確保可見 */
}

.cta-button:hover { transform: translateY(-3px); background-color: white !important; box-shadow: 0 0 30px rgba(237, 190, 90, 0.6); }

/* 商城外部容器 */
#store {
    background: rgba(0,0,0,0.7); /* 加深一點背景，讓卡片更明顯 */
    backdrop-filter: blur(10px);
    padding: 100px 20px;
    width: 100%;
}

.store-container {
    max-width: 1200px;
    margin: 0 auto; /* 整個區塊置中 */
    text-align: center;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 60px;
    font-weight: 900;
    letter-spacing: 2px;
}

/* 找到並替換原本的 .card */
.card {
    background: rgba(20, 20, 25, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px 30px;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* 核心修正：給定固定寬度範圍，防止變太瘦或太寬 */
    width: 350px; 
    min-height: 520px;
    
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.4s ease, box-shadow 0.4s ease;
    opacity: 1;
    position: relative;
    overflow: hidden;
    text-align: center; /* 確保內容文字也置中 */

    /* 核心修正：給定固定寬度範圍，就不會忽胖忽瘦或歪掉 */
    width: 350px; 
    flex-shrink: 0;        /* 防止卡片被擠壓變形 */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;    /* 卡片內文字置中 */
}

.grid {
    display: flex;         /* 改用 Flex 佈局，處理少量卡片最穩定 */
    flex-wrap: wrap;
    justify-content: center; /* 核心修正：卡片永遠從中間開始排 */
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    margin: 40px auto 0 auto;
}

/* 移除滑鼠滑過的反白，改為精緻的邊框變色 */
.card:hover {
    transform: translateY(-15px); 
    border-color: var(--primary); 
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    /* 這裡絕對不要寫 background，就不會反白 */
}

/* 商品圖片區域 */
.card-img { 
    font-size: 5rem; 
    height: 180px; 
    width: 100%;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 25px; 
    border-radius: 10px; 
    background: rgba(255,255,255,0.03); 
}

.price { font-size: 1.8rem; font-weight: 900; color: var(--primary); margin-bottom: 25px; }

/* 按鈕加大與觸控反饋 */
.buy-btn {
    width: 100%;
    padding: 22px 15px;      /* 再次加大 Padding */
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    cursor: pointer;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 1px;
    border-radius: 8px;
    margin-top: auto;        /* 頂到底部 */
    transition: 0.3s;
}

/* 增加按鈕點擊時的縮放效果 (觸控反饋) */
.buy-btn:active {
    transform: scale(0.95);  /* 按下去的縮放感 */
}

.buy-btn:hover {
    background: var(--primary);
    color: #000;
}

footer {
    width: 100%;
    padding: 40px 0;
    background: rgba(0, 0, 0, 0.9);
    text-align: center; /* 這是關鍵 */
}

footer p {
    margin: 0; /* 清除可能存在的 left margin */
    display: inline-block;
}

/* --- 1. 修正伺服器介紹 (Intro) --- */
#intro {
    background: rgba(0, 0, 0, 0.75); /* 黑色半透明背景 */
    backdrop-filter: blur(10px);    /* 霧面毛玻璃效果 */
    -webkit-backdrop-filter: blur(10px);
    padding: 100px 10%;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05); /* 頂部一條淡淡的細線增加質感 */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#intro .store-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* 強制容器內元素水平置中 */
}

#intro p {
    text-align: center;    /* 確保內文置中 */
    margin: 0 auto 25px auto;
    max-width: 850px;
    color: #e0e0e0;
}

/* 雪花的樣式 */
.snowflake {
    position: fixed;
    top: -10px;
    background-color: white;
    border-radius: 50%;
    pointer-events: none; /* 確保雪花不會擋住滑鼠點擊 */
    z-index: 99;         /* 讓雪花飄在內容前方，但低於導覽列 */
    filter: blur(1px);   /* 稍微模糊看起來更自然 */
}


.scroll-indicator {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.6;
    animation: bounce 2s infinite; /* 上下跳動動畫 */
}

.scroll-indicator p {
    font-size: 0.8rem;
    letter-spacing: 2px;
    margin-top: 10px;
}

.mouse {
    width: 25px;
    height: 40px;
    border: 2px solid white;
    border-radius: 20px;
    position: relative;
}

.mouse::before {
    content: "";
    width: 4px;
    height: 8px;
    background: white;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 8px;
    border-radius: 2px;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* 彈窗背景變暗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

/* 視窗啟動時的樣式 */
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 登入卡片主體 */
.modal-card {
    background: rgba(20, 20, 25, 0.95);
    width: 90%;
    max-width: 450px;
    padding: 50px 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    text-align: center;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

/* 關閉按鈕 */
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #666;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
}
.close-btn:hover { color: white; }

/* Discord 圖示動畫 */
.discord-logo-wrapper img {
    width: 70px;
    margin-bottom: 25px;
    filter: drop-shadow(0 0 10px rgba(88, 101, 242, 0.5));
}

/* Discord 登入按鈕 */
.discord-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #5865F2;
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: bold;
    margin-top: 30px;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.3);
}

.discord-login-btn:hover {
    background: #4752c4;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(88, 101, 242, 0.5);
}

.modal-footer {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #555;
}
.modal-footer a { color: #888; }

/* 登入後的容器排版 */
.user-logged-in {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 登出按鈕的樣式 */
.logout-style {
    background: rgba(255, 71, 71, 0.2);
    border: 1px solid rgba(255, 71, 71, 0.5);
    color: #ff9999;
    padding: 2px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.logout-style:hover {
    background: rgba(255, 71, 71, 0.8);
    color: white;
    box-shadow: 0 0 10px rgba(255, 71, 71, 0.5);
}