/* ===================================== */
/* == 全局變數與基礎設定 == */
/* ===================================== */
:root {
    --primary-color: #FF7B25;
    --primary-dark: #E56A1B;
    --primary-light: #FF9D5C;
    --bg-dark: #121212;
    --bg-darker: #0A0A0A;
    --bg-light: #1E1E1E;
    --text-primary: #FFFFFF;
    --text-secondary: #BBBBBB;
    --text-tertiary: #888888;
    --accent-color: #4A90E2;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --error-color: #F44336;
    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===================================== */
/* == 防護功能 CSS == */
/* ===================================== */
@media print {
    body {
        display: none !important;
        /* 防列印 */
    }
}

/* 防選取文字 (CSS 方式) */
body {
    -webkit-touch-callout: none;
    /* iOS Safari */
    -webkit-user-select: none;
    /* Safari */
    -khtml-user-select: none;
    /* Konqueror HTML */
    -moz-user-select: none;
    /* Old versions of Firefox */
    -ms-user-select: none;
    /* Internet Explorer/Edge */
    user-select: none;
    /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
}

/* 確保按鈕等可互動元素仍有指針樣式 */
button,
a,
input,
textarea {
    cursor: pointer;
    user-select: auto;
    /* 允許這些元素內的文字被選取，如果需要的話 */
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
}

/* ===================================== */
/* == 基礎樣式 == */
/* ===================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    scroll-behavior: smooth;
}

/* 平滑滾動效果 */
.scrollable-main-content {
    scroll-behavior: smooth;
}

/* 移除點擊時的黑線 - 針對超連結元素強化 */
a,
a:focus,
a:active {
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}

/* ===================================== */
/* == 頂部固定區域 == */
/* ===================================== */
.fixed-top-section {
    width: 100%;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    position: relative;
    z-index: 10;
    box-shadow: var(--shadow-md);
    padding-bottom: 10px;
}

.fixed-top-section>div,
.scrollable-main-content {
    padding-left: 20px;
    padding-right: 20px;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding-top: 25px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 修改LOGO大小為原來的2倍 (從60px調整到120px) */
.header-logo {
    height: 120px;
    /* 放大2倍 */
    margin-bottom: 20px;
    /* 增加間距以適應更大的LOGO */
}

.main-title {
    color: var(--primary-color);
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    display: inline-block;
}

.main-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    padding: 8px 0;
    position: relative;
}

.marquee-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(90deg, var(--bg-dark), transparent);
    z-index: 2;
}

.marquee-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 100%;
    background: linear-gradient(270deg, var(--bg-dark), transparent);
    z-index: 2;
}

.marquee {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 18s linear infinite;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ===================================== */
/* == 常用按鈕區塊 (已優化PC和手機的滑動體驗) == */
/* ===================================== */
.common-buttons-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 15px;
    margin-bottom: 10px;
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--primary-color) var(--bg-light);
    /* Firefox */
    cursor: grab;
}

.common-buttons-container::-webkit-scrollbar {
    height: 8px;
    /* Chrome, Safari and Opera */
}

.common-buttons-container::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 4px;
}

.common-buttons-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}

.common-buttons-container:active {
    cursor: grabbing;
}

.common-buttons {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 15px;
    padding: 0 10px 10px;
    user-select: none;
}

.common-button {
    width: 100px;
    height: 120px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
    text-decoration: none;
    display: block;
    border: none;
    box-shadow: var(--shadow-sm);
    background: var(--bg-light);
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.common-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.15);
}

.common-image {
    width: 100%;
    height: 80px;
    object-fit: contain;
    display: block;
    border: none;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: all var(--transition-normal);
}

.common-button:hover .common-image {
    background: rgba(255, 255, 255, 0.1);
}

.common-label {
    width: 100%;
    padding: 10px 5px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    transition: all var(--transition-normal);
}

.common-button:hover .common-label {
    background: rgba(0, 0, 0, 0.6);
}

/* ===================================== */
/* == 主要內容捲動區域 == */
/* ===================================== */
.scrollable-main-content {
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 15px;
    background: var(--bg-dark);
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

/* 隱藏所有滾動條 */
.scrollable-main-content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

/* ===================================== */
/* == 主按鈕網格 == */
/* ===================================== */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 25px;
    max-width: 2000px;
    margin: 0 auto;
    padding-top: 15px;
    padding-bottom: 40px;
}

/* 主按鈕樣式 */
.image-button {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    width: 100%;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    border: none;
    position: relative;
    background: var(--bg-light);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.image-button:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.15);
}

.image-container {
    width: 100%;
    height: 180px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    transition: all var(--transition-normal);
}

.image-button:hover .image-container {
    background: rgba(255, 255, 255, 0.07);
}

.image-container img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    display: block;
    transition: all var(--transition-normal);
}

.image-button:hover .image-container img {
    transform: scale(1.05);
}

.button-label {
    padding: 15px 12px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 1;
}

.button-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.image-button:hover .button-label::before {
    transform: scaleX(1);
}

.image-button:hover .button-label {
    color: var(--primary-color);
}

/* ===================================== */
/* == 說明按鈕樣式 == */
/* ===================================== */
.description-toggle {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--text-primary);
    cursor: pointer;
    margin-top: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all var(--transition-fast);
    line-height: 1;
    box-shadow: var(--shadow-sm);
}

.description-toggle:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-dark);
    transform: rotate(180deg);
}

/* ===================================== */
/* == 說明文字框樣式 == */
/* ===================================== */
.description-tooltip-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    color: var(--text-primary);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.5;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.description-tooltip-box.active {
    opacity: 1;
    visibility: visible;
}

.description-tooltip-box p {
    margin-bottom: 20px;
    font-weight: 400;
    max-width: 100%;
    color: var(--text-secondary);
}

.description-tooltip-box p strong {
    color: var(--primary-color);
    font-weight: 600;
}

.close-tooltip-box {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-size: 0.8rem;
    padding: 6px 15px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.close-tooltip-box:hover {
    background-color: var(--primary-color);
    color: var(--bg-dark);
    transform: translateY(-2px);
}

/* ===================================== */
/* == 動畫效果 == */
/* ===================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-button {
    animation: fadeIn 0.5s ease forwards;
    opacity: 0;
}

/* 為按鈕添加不同的動畫延遲 */
.image-button:nth-child(1) {
    animation-delay: 0.1s;
}

.image-button:nth-child(2) {
    animation-delay: 0.2s;
}

.image-button:nth-child(3) {
    animation-delay: 0.3s;
}

.image-button:nth-child(4) {
    animation-delay: 0.4s;
}

.image-button:nth-child(5) {
    animation-delay: 0.5s;
}

.image-button:nth-child(6) {
    animation-delay: 0.6s;
}

.image-button:nth-child(7) {
    animation-delay: 0.7s;
}

.image-button:nth-child(8) {
    animation-delay: 0.8s;
}

.image-button:nth-child(9) {
    animation-delay: 0.9s;
}

.image-button:nth-child(10) {
    animation-delay: 1.0s;
}

.image-button:nth-child(11) {
    animation-delay: 1.1s;
}

.image-button:nth-child(12) {
    animation-delay: 1.2s;
}

.image-button:nth-child(13) {
    animation-delay: 1.3s;
}

.image-button:nth-child(14) {
    animation-delay: 1.4s;
}

.image-button:nth-child(15) {
    animation-delay: 1.5s;
}

.image-button:nth-child(16) {
    animation-delay: 1.6s;
}

.image-button:nth-child(17) {
    animation-delay: 1.7s;
}

.image-button:nth-child(18) {
    animation-delay: 1.8s;
}

/* ===================================== */
/* == 響應式設計 == */
/* ===================================== */
@media (max-width: 2000px) {
    .button-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (max-width: 1800px) {
    .button-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 1500px) {
    .button-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1200px) {
    .button-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .main-title {
        font-size: 2.5rem;
    }

    .header-logo {
        height: 100px;
        /* 響應式調整 */
    }
}

@media (max-width: 900px) {
    .button-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .common-button {
        width: 90px;
        height: 110px;
    }

    .common-image {
        height: 75px;
    }

    .image-container {
        height: 160px;
    }

    .header-logo {
        height: 90px;
        /* 響應式調整 */
    }
}

@media (max-width: 700px) {
    .button-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .main-title {
        font-size: 2.2rem;
    }

    .marquee {
        font-size: 0.8rem;
    }

    .header-logo {
        height: 80px;
        /* 響應式調整 */
    }
}

@media (max-width: 500px) {
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .common-buttons {
        gap: 10px;
    }

    .common-button {
        width: 80px;
        height: 100px;
    }

    .common-image {
        height: 70px;
        padding: 8px;
    }

    .common-label {
        font-size: 0.65rem;
        padding: 8px 3px;
    }

    .image-container {
        height: 140px;
    }

    .button-label {
        padding: 12px 8px;
        height: 60px;
        font-size: 0.9rem;
    }

    .description-tooltip-box {
        padding: 15px;
        font-size: 0.85rem;
    }

    .close-tooltip-box {
        font-size: 0.7rem;
        padding: 5px 12px;
    }

    .description-toggle {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }

    .main-title {
        font-size: 2rem;
    }

    .marquee {
        font-size: 0.75rem;
    }

    .header-logo {
        height: 70px;
        /* 響應式調整 */
    }
}

@media (max-width: 400px) {

    .fixed-top-section>div,
    .scrollable-main-content {
        padding-left: 15px;
        padding-right: 15px;
    }

    .button-grid {
        gap: 12px;
    }

    .common-buttons {
        gap: 8px;
    }

    .header-logo {
        height: 60px;
        /* 響應式調整 */
    }
}