/* ========================================
   今彩539智能分析系統 - 手機優先設計
   ======================================== */

/* ========================================
   基礎重置與變數
   ======================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* All CSS variables now defined in themes.css */

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-base);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}

/* ========================================
   跳轉連結
   ======================================== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--space-md);
    text-decoration: none;
    z-index: 9999;
}

.skip-link:focus {
    top: 0;
}

/* ========================================
   容器
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ========================================
   玉安宮 + 開獎倒數
   ======================================== */
.temple {
    position: relative;
    text-align: center;
    padding: var(--space-xxl) var(--space-md) var(--space-xxl);
    background-image: url('../assets/image/banner.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 1px solid var(--color-border);
    min-height: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.temple::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 0;
}

.temple__img {
    position: relative;
    z-index: 1;
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.temple__title {
    position: relative;
    z-index: 1;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-white);
    text-shadow: 3px 3px 8px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.1em;
    margin-top: var(--space-lg);
}

/* 開獎倒數卡片 */
.countdown-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 500px;
    margin-bottom: var(--space-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.countdown-card__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.0); /* 黑色遮罩透明度 */
    backdrop-filter: blur(8px);
    z-index: 1;
}

.countdown-card__content {
    position: relative;
    z-index: 2;
    padding: var(--space-lg);
}

.countdown-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-white);
    text-align: center;
    margin-bottom: var(--space-md);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ========================================
   標題列
   ======================================== */
.header {
    position: sticky;
    top: 0;
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-md) 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.header__title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
}

.theme-btn {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    width: 44px;
}

.theme-btn:hover {
    background: var(--color-border);
}

.theme-btn__icon {
    font-size: 1.25rem;
}

/* ========================================
   主內容
   ======================================== */
.main {
    padding: var(--space-lg) 0;
}

/* ========================================
   載入與錯誤狀態
   ======================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    gap: var(--space-md);
}

.loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading__text {
    color: var(--color-text-light);
}

.error {
    text-align: center;
    padding: var(--space-xl);
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-lg);
    margin: var(--space-lg) var(--space-md);
}

.error__title {
    color: var(--color-error);
    margin-bottom: var(--space-md);
}

.error__msg {
    color: var(--color-text-light);
    margin-bottom: var(--space-lg);
}

/* ========================================
   內容區
   ======================================== */
.content {
    display: grid;
    gap: var(--space-lg);
    padding: 0 var(--space-md);
}

.card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

/* Birthday section special background removed - styles now defined in themes.css for consistency */

.card__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

/* ========================================
   按鈕
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    transition: all 0.2s;
}

.btn--primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn--primary:hover {
    background: var(--color-primary-dark);
}

/* ========================================
   頁尾
   ======================================== */
.footer {
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: var(--space-xl) 0;
    margin-top: var(--space-xl);
    text-align: center;
}

.footer__copy,
.footer__notice {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin: var(--space-xs) 0;
}

/* ========================================
   平板 (768px+)
   ======================================== */
@media (min-width: 768px) {
    .temple {
        min-height: 500px;
    }

    .temple__img {
        max-width: 250px;
    }

    .temple__title {
        font-size: 3.5rem;
    }

    .countdown-card {
        max-width: 600px;
    }

    .countdown-card__title {
        font-size: 1.5rem;
    }

    .header__title {
        font-size: 1.5rem;
    }

    .content {
        grid-template-columns: repeat(2, 1fr);
        padding: 0 var(--space-lg);
    }

    .card:first-child {
        grid-column: 1 / -1;
    }
}

/* ========================================
   桌面 (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    .temple {
        min-height: 550px;
    }

    .temple__img {
        max-width: 300px;
    }

    .temple__title {
        font-size: 4rem;
    }

    .content {
        grid-template-columns: 2fr 1fr;
        grid-template-rows: auto auto;
        gap: var(--space-xl);
    }

    .card:first-child {
        grid-column: 1;
        grid-row: 1 / 4;
    }

    .card:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .card:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }

    .card:nth-child(4) {
        grid-column: 2;
        grid-row: 3;
    }
}

/* ========================================
   減少動畫
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}