/* --- 通用樣式 (適用於所有頁面) --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

h1 { text-align: center; color: #333; margin-top: 20px; margin-bottom: 40px; }

/* --- 主選單頁面專用 --- */
.menu-page-wrapper { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 90vh; }
.menu-container { display: flex; flex-direction: column; gap: 15px; }
.menu-button {
    display: block; background-color: #4a69bd; color: white; text-decoration: none; padding: 15px 30px;
    font-size: 1.3em; text-align: center; border-radius: 8px; transition: background-color 0.3s, transform 0.2s; width: 320px;
}
.menu-button:hover { background-color: #6a89cc; transform: translateY(-3px); }

/* --- 返回主選單按鈕 (內頁使用) --- */
.back-to-menu-button {
    display: inline-block; background-color: #6c757d; color: white; padding: 8px 15px;
    margin-bottom: 20px; text-decoration: none; border-radius: 5px; transition: background-color 0.3s;
}
.back-to-menu-button:hover { background-color: #5a6268; }

/* --- 通用網格與儲存格樣式 --- */
.gallery-cell {
    background-color: #fff; padding: 20px 15px; text-align: center; display: flex;
    flex-direction: column; align-items: center; justify-content: space-between; gap: 15px;
}
.gallery-cell h3 { margin: 0; font-size: 1.2em; color: #444; }
.gallery-image { max-width: 120px; height: auto; cursor: pointer; border-radius: 4px; transition: transform 0.2s ease, box-shadow 0.2s ease; border: 1px solid #eee; display: block; }
.gallery-image:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.filename { margin: 5px 0 0 0; font-size: 0.9em; color: #666; font-family: 'Courier New', Courier, monospace; }

/* --- 雙圖排版 (一般印圖、印陽體) --- */
.image-pair { display: flex; justify-content: center; align-items: center; gap: 15px; }
.image-container { display: flex; flex-direction: column; align-items: center; }
.image-container .gallery-image, .image-pair > .gallery-image { max-width: 100px; }

/* --- 一般印圖 & 印陽體印圖 (4 欄網格) --- */
.gallery-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background-color: #ccc; border: 1px solid #ccc; max-width: 1200px; margin: 0 auto; }
@media (max-width: 992px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .gallery-grid { grid-template-columns: 1fr; } }

/* --- 龍錢印圖 5 欄網格 --- */
.gallery-grid-5-cols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background-color: #ccc; border: 1px solid #ccc; max-width: 1400px; margin: 0 auto; }
@media (max-width: 1200px) { .gallery-grid-5-cols { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 992px) { .gallery-grid-5-cols { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .gallery-grid-5-cols { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .gallery-grid-5-cols { grid-template-columns: 1fr; } }

/* --- 【新增】3D立體印圖 (3 欄網格) --- */
.gallery-grid-3-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background-color: #ccc; border: 1px solid #ccc; max-width: 900px; margin: 0 auto; }
@media (max-width: 768px) { .gallery-grid-3-cols { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .gallery-grid-3-cols { grid-template-columns: 1fr; } }

/* --- 印陽體 & 3D頁面專用樣式 --- */
.info-bar { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.code-pill {
    background-color: #FBCB0A; color: black; border: 1px solid #A98600;
    border-radius: 20px; padding: 5px 15px; font-weight: bold;
    font-family: 'Courier New', Courier, monospace; box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.font-name { font-size: 1.1em; color: #d63031; font-weight: bold; }
.price-note { font-size: 0.9em; color: #d63031; font-weight: bold; margin: -5px 0 0 0; }

/* --- 彈出式視窗 (Modal) --- */
.modal { position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow-y: auto; background-color: rgba(0, 0, 0, 0.88); display: flex; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
.modal-wrapper { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.modal-content { display: block; max-width: 90vw; max-height: 75vh; border-radius: 5px; }
.close-button { background-color: #E85D4A; color: white; border: none; padding: 10px 28px; font-size: 16px; font-weight: bold; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; flex-shrink: 0; }
.close-button:hover { background-color: #D94A38; }
.hidden { display: none; }