/* ----------------- 全局：使用安全置中佈局與高級配色 ----------------- */
body {
    font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
    /* 乾淨、柔和的背景色 */
    background: #f8faff; 
    color: #333;
    margin: 0;
    padding: 0;
    /* 關鍵：使用全局置中，確保所有頁面佈局穩定 */
    text-align: center; 
    line-height: 1.6;
}

a { 
    text-decoration: none; 
    /* 連結顏色：深海藍 */
    color: #4e5b7b; 
    transition: color 0.3s;
}

a:hover {
    color: #394561;
}

h1, h2, h3 {
    /* 標題顏色：深灰藍 */
    color: #2c3e50; 
    font-weight: 700;
    margin-top: 0;
}

/* ----------------- 上方選單：Premium 深藍色按鈕 ----------------- */
.top-nav {
    text-align: center;
    padding: 1rem 0;
    background: rgba(255, 255, 255, 0.98); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.08); 
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #eee; 
}

.top-nav a {
    color: #fff;
    /* 核心：使用深海藍漸變 */
    background: linear-gradient(180deg, #5c6c94 0%, #4e5b7b 100%); 
    border: none;
    padding: 0.8rem 1.5rem;
    margin: 0 0.75rem; 
    border-radius: 8px; 
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
    /* 陰影：讓按鈕浮出 */
    box-shadow: 0 4px 10px rgba(78, 91, 123, 0.35); 
}

.top-nav a:hover {
    background: #394561; 
    box-shadow: 0 6px 15px rgba(78, 91, 123, 0.5); 
    transform: translateY(-1px); 
}

/* ----------------- 主內容區：恢復安全寬度與置中 ----------------- */
.main-content {
    /* 恢復到您原來的 600px 限制 */
    max-width: 600px; 
    /* 使用 auto 置中 */
    margin: 2rem auto; 
    padding: 0 1rem;
    /* 確保內容卡片可以靠左 (這是部落格/文章所需的) */
    text-align: left; 
}

/* ----------------- 卡片樣式 (incard)：重點在美化，佈局不動 ----------------- */
.incard {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    /* 高級陰影 */
    box-shadow: 0 8px 20px rgba(0,0,0,0.08); 
    border: 1px solid #f0f0f0; /* 增加極淺邊框 */
    text-align: center; /* 讓內容置中，與您的工具頁面一致 */
}

/* ----------------- 實心主要按鈕 (用於 .button-group, .card button) ----------------- */
.button-group button,
.card button {
    /* 使用深海藍漸變 */
    background: linear-gradient(180deg, #5c6c94 0%, #4e5b7b 100%); 
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(78, 91, 123, 0.35); 
    width: auto;
}

.button-group button:hover,
.card button:hover {
    background: #394561;
    box-shadow: 0 8px 20px rgba(78, 91, 123, 0.5); 
    transform: translateY(-1px);
}

/* ----------------- 基礎線框按鈕 (button) ----------------- */
button {
    /* 線框顏色：深海藍 */
    color: #4e5b7b;
    background: none;
    border: 2px solid #4e5b7b; 
    border-radius: 8px;
    padding: 0.7rem 1.4rem;
    margin: 0.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    color: #fff;
    background: #4e5b7b;
    box-shadow: 0 4px 10px rgba(78, 91, 123, 0.3);
}

/* ----------------- Holiday按鈕美化 ----------------- */
.holiday-list {
    text-align: center; 
    margin-top: 1.5rem; 
    padding: 0; /* 移除容器多餘的內邊距 */
    
    /* 讓容器更簡潔，移除多餘的邊界和陰影，融入 incard */
    border: none; 
    background: none; 
    box-shadow: none; 
    
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center; /* 確保按鈕水平置中 */
    gap: 0.75rem; /* 保持按鈕間距 */
}
  
/* ----------------- Holiday按鈕本身美學 ----------------- */
.holiday-item {
    background: #4e5b7b;
    color: #fff;
    padding: 0.7rem 1.3rem;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    display: inline-block; /* 確保它能適應內容寬度 */
    border: none;
    transition: all 0.3s ease;
    /* 使用較淺陰影，讓它看起來像浮在列表上方 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); 
}

.holiday-item:hover {
    background: #394561;
    transform: scale(1.02);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* ----------------- 倒數計時數字 ----------------- */
.timer {
    font-size: 2.5rem; 
    font-weight: 700; 
    color: #4e5b7b; /* 使用主題色 */
    margin: 1rem 0;
}

/* === 尺寸轉換器卡片樣式 (.card) === */
.card {
    background: #ffffff; 
    padding: 1.5rem; 
    width: 350px; /* 這裡有固定寬度 */
    
    /* 🚨 關鍵修正：使用 margin: auto 確保區塊置中 */
    margin: 30px auto; 
    
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(0,0,0,0.08);
    border: 1px solid #e5e5e5;
    transition: 0.25s ease;
}
/* ----------------- 網段計算機 (專屬按鈕與響應式佈局) ----------------- */

/* 按鈕專屬樣式 - 使用實心主要按鈕的樣式 (Deep Navy) */
.calculator button {
    /* 確保使用高級感的深海藍漸變 */
    background: linear-gradient(180deg, #5c6c94 0%, #4e5b7b 100%); 
    color: #fff;
    cursor: pointer;
    border: none;
    font-weight: 600; /* 統一字重 */
    /* 保持高級陰影效果 */
    box-shadow: 0 5px 15px rgba(78, 91, 123, 0.35); 
    transition: all 0.3s ease;
}

.calculator button:hover {
    background: #394561; 
    box-shadow: 0 8px 20px rgba(78, 91, 123, 0.5); 
}

/* 多按鈕排列 */
.calculator .button-group {
    display: flex;
    gap: 0.75rem; /* 保持與我們其他 flex 佈局一致的間距 */
}

.calculator .button-group button {
    flex: 1; /* 平均分配寬度 */
}

/* 響應式設計 */
@media (max-width: 480px) {
    /* 這裡不再需要 max-width 或 padding，因為 .main-content 已經處理了 */
    
    .calculator .button-group {
        flex-direction: column; /* 小螢幕時垂直堆疊 */
    }
}

/* ----------------- 網段計算機結果顯示優化 ----------------- */

.result-grid {
    display: grid;
    /* 讓標籤和結果分兩欄顯示，更清晰 */
    grid-template-columns: auto 1fr; 
    gap: 15px 10px;
    text-align: left;
    padding: 10px 0;
    font-size: 1.1em;
}

.result-grid strong {
    color: #2c3e50; /* 深色標籤 */
    padding-right: 15px;
}

.result-grid span {
    font-weight: 500;
    color: #4e5b7b; /* 主題色結果 */
}