/* ===========================
   天堂私服網站 - 主題樣式
   =========================== */

/* CSS 變數 */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;

    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);

    --radius: 12px;
    --radius-sm: 8px;
}

/* 重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(15, 23, 42, 0.95) 100%),
        url('../images/hero-bg.jpg') center top/cover no-repeat fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===========================
   導航列
   =========================== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    font-size: 1.5rem;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===========================
   按鈕
   =========================== */
.btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.btn-large {
    padding: 1rem 3rem;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===========================
   主內容區
   =========================== */
.main-content {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* ===========================
   卡片
   =========================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* ===========================
   首頁
   =========================== */
.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.1));
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border-color);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===========================
   簽到頁面
   =========================== */
.checkin-status {
    display: flex;
    justify-content: center;
    gap: 4rem;
    text-align: center;
}

.status-item {
    display: flex;
    flex-direction: column;
}

.status-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.status-item .value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-light);
}

.status-item .unit {
    color: var(--text-muted);
}

#checkinBtn {
    display: block;
    margin: 2rem auto;
}

.checkin-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    font-size: 0.9rem;
}

.calendar-day.checked {
    background: var(--primary);
    color: white;
}

.calendar-day.today {
    border: 2px solid var(--accent);
}

/* ===========================
   抽獎頁面
   =========================== */
.lottery-pools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.pool-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.pool-card:hover {
    border-color: var(--primary);
}

.pool-card h3 {
    margin-bottom: 0.5rem;
}

.pool-card .cost {
    color: var(--accent);
    margin-bottom: 1rem;
}

.lottery-recent ul {
    list-style: none;
}

.lottery-recent li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.lottery-recent li:last-child {
    border-bottom: none;
}

/* ===========================
   活動頁面
   =========================== */
.activity-list {
    display: grid;
    gap: 1rem;
}

.activity-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-info h4 {
    margin-bottom: 0.5rem;
}

.activity-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===========================
   推廣頁面
   =========================== */
.promotion-form {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.promotion-history {
    max-width: 800px;
    margin: 0 auto;
}

.promotion-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.promotion-item:last-child {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent);
}

.status-approved {
    background: rgba(16, 185, 129, 0.2);
    color: var(--secondary);
}

.status-rejected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* ===========================
   獎勵頁面
   =========================== */
.rewards-pending,
.rewards-history {
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

.rewards-pending ul,
.rewards-history ul {
    list-style: none;
}

.reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.reward-item:last-child {
    border-bottom: none;
}

.reward-info .source {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.reward-count {
    color: var(--primary-light);
    font-weight: 600;
}

/* ===========================
   彈窗
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ===========================
   Toast
   =========================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    padding: 1rem 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s;
    z-index: 300;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--secondary);
}

.toast.error {
    border-color: var(--danger);
}

/* ===========================
   響應式
   =========================== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .nav-item {
        white-space: nowrap;
        padding: 0.5rem 0.8rem;
    }

    .hero {
        padding: 3rem 1rem;
        margin-bottom: 1.5rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .checkin-status {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .slider-captcha {
        padding: 0.75rem;
    }

    .captcha-bg {
        height: 100px;
        /* 手機端稍微壓低高度以免擋住鍵盤 */
    }
}

/* ===========================
   滑塊驗證 CAPTCHA
   =========================== */
.slider-captcha {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.captcha-bg {
    position: relative;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

/* 背景圖案 */
.captcha-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.1) 0%, transparent 60%);
}

.captcha-slot {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 2px dashed rgba(255, 255, 255, 0.5);
}

.captcha-piece {
    position: absolute;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fff 0%, #e0e0e0 100%);
    border-radius: 8px;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.captcha-piece::before {
    content: '🧩';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
}

.captcha-piece.matched {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.captcha-piece.matched::before {
    content: '✓';
    color: white;
}

.slider-track {
    position: relative;
    height: 44px;
    background: var(--bg-dark);
    border-radius: 22px;
    overflow: hidden;
}

.slider-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s;
}

.slider-handle {
    position: absolute;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    left: 0;
    top: 0;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
    transition: box-shadow 0.2s;
    user-select: none;
}

.slider-handle:hover {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.6);
}

.slider-handle:active {
    cursor: grabbing;
}

.slider-handle.success {
    background: linear-gradient(135deg, var(--secondary), #059669);
}

.captcha-status {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.captcha-status.success {
    color: var(--secondary);
}

.captcha-status.error {
    color: var(--danger);
}

/* 浮動動畫效果 */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* 脈衝動畫效果 */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    }
}

/* ===========================
   音樂控制按鈕
   =========================== */
.music-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid var(--lineage-gold, #d4a849);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(212, 168, 73, 0.2);
    transition: all 0.3s ease;
}

.music-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 168, 73, 0.4);
}

.music-toggle.playing {
    animation: musicPulse 2s ease-in-out infinite;
}

@keyframes musicPulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(212, 168, 73, 0.2);
    }

    50% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 40px rgba(212, 168, 73, 0.5);
    }
}

/* ===========================
   遊戲區樣式 (Migrated from Games.css to fix FOUC)
   =========================== */
.games-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.game-card {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #444;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.game-card:hover {
    border-color: #ffd700;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
}

.game-image {
    height: 200px;
    background: linear-gradient(135deg, #ff6b35, #cc4400);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

.game-info {
    padding: 20px;
}

.game-title {
    font-size: 24px;
    font-weight: 900;
    color: #ffd700;
    margin: 0 0 10px 0;
}

.game-desc {
    color: #aaa;
    font-size: 14px;
    line-height: 1.6;
}

.game-tags {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.game-tag {
    background: rgba(155, 89, 182, 0.3);
    color: #9b59b6;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
}

.game-tag.hot {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.btn-play {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(180deg, #ffd700, #b8860b);
    border: none;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-play:hover {
    filter: brightness(1.1);
}

.back-link {
    display: inline-block;
    margin-bottom: 30px;
    color: #888;
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: white;
}

.coming-soon {
    opacity: 0.5;
    pointer-events: none;
}

.coming-soon .btn-play {
    background: linear-gradient(180deg, #666, #444);
}

.games-notice {
    background: linear-gradient(90deg, rgba(241, 196, 15, 0.1), rgba(231, 76, 60, 0.1));
    border-left: 3px solid #f1c40f;
    border-radius: 8px;
    padding: 16px 24px;
    margin-bottom: 30px;
}

.games-action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
}

.games-action-buttons {
    display: flex;
    gap: 10px;
}

.btn-game-action {
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    display: inline-block;
}

.btn-blue {
    background: linear-gradient(90deg, #3498db, #2980b9);
}

.btn-orange {
    background: linear-gradient(90deg, #f39c12, #e74c3c);
}