/* ==========================================
   IPTV Pro - 暗黑纯黑 / 纯白风格
   ========================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #fff;
    --card-bg:   #fff;
    --card-bdr:  rgba(0,0,0,0.06);
    --text:      #111;
    --text-dim:  #555;
    --shadow:    0 1px 3px rgba(0,0,0,0.04), 0 6px 20px rgba(0,0,0,0.05);
    --shadow-hv: 0 2px 8px rgba(0,0,0,0.06), 0 16px 48px rgba(0,0,0,0.08);
    --primary:   #6366f1;
    --accent:    #10b981;
    --dl:        #f59e0b;
    --dl-h:      #d97706;
    --nav-bg:    rgba(255,255,255,0.9);
    --dot:       rgba(99,102,241,0.14);
    --line:      rgba(99,102,241,0.06);
    --pill-bg:   rgba(99,102,241,0.06);
    --pill-c:    #6366f1;
}
.dark-theme {
    --bg:        #000;
    --card-bg:   #111;
    --card-bdr:  rgba(255,255,255,0.06);
    --text:      #eee;
    --text-dim:  #888;
    --shadow:    0 1px 3px rgba(0,0,0,0.4), 0 6px 20px rgba(0,0,0,0.3);
    --shadow-hv: 0 2px 8px rgba(99,102,241,0.08), 0 16px 48px rgba(0,0,0,0.5);
    --nav-bg:    rgba(17,17,17,0.9);
    --dot:       rgba(255,255,255,0.1);
    --line:      rgba(255,255,255,0.04);
    --pill-bg:   rgba(99,102,241,0.1);
    --pill-c:    #a5b4fc;
}

html, body {
    width: 100%; margin: 0; padding: 0; overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f0f0f5; color: var(--text);
    -webkit-font-smoothing: antialiased;
}
html.dark-theme, html.dark-theme body {
    background: #0a0a12;
}

/* ---- 主题按钮 ---- */
.theme-toggle {
    position: fixed; top: 1.5rem; right: 1.5rem; z-index: 100;
    width: 42px; height: 42px; border-radius: 12px;
    background: rgba(255,255,255,0.4); border: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s;
}
.dark-theme .theme-toggle {
    background: rgba(17,17,17,0.45); border-color: rgba(255,255,255,0.08);
}
.theme-toggle:hover { transform: scale(1.06); }
.theme-icon { width: 18px; height: 18px; color: var(--text); }
.dark-theme .theme-icon.light { display: none; }
.theme-icon.dark { display: none; }
.dark-theme .theme-icon.dark { display: block; }

/* ---- 翻页容器 ---- */
@media (min-width: 768px) {
    .page-container { position: relative; width: 100%; height: 100vh; overflow: hidden; }
    .page {
        position: absolute; top: 0; left: 0;
        width: 100%; height: 100vh;
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        padding: 2rem;
        transition: transform 0.5s cubic-bezier(0.32,0.72,0,1);
    }
    .page-1 { transform: translateY(0); }
    .page-2 { transform: translateY(100%); }
    .page-container.flipped .page-1 { transform: translateY(-100%); }
    .page-container.flipped .page-2 { transform: translateY(0); }
}

/* ---- 页面头部 ---- */
.page-header { text-align: center; margin-bottom: 2.5rem; z-index: 1; }
.brand-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 0.9rem; border-radius: 999px;
    background: var(--pill-bg); color: var(--pill-c);
    font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em;
    margin-bottom: 1rem;
}
.page-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800;
    letter-spacing: -0.03em; margin-bottom: 0.5rem;
}
.page-subtitle {
    font-size: clamp(0.88rem, 1.4vw, 1.05rem); color: var(--text-dim);
    max-width: 480px; margin: 0 auto;
}

/* ---- 卡片网格 ---- */
.card-grid {
    display: grid; gap: 1.25rem; width: 100%; max-width: 1060px;
    justify-content: center; z-index: 1;
}
.entry-grid { grid-template-columns: repeat(auto-fit, minmax(310px, 380px)); }
.download-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 240px)); }

/* ---- 卡片 ---- */
.card {
    position: relative; overflow: hidden;
    background: rgba(255,255,255,0.45); border: 1px solid rgba(255,255,255,0.25); border-radius: 18px;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    padding: 1.8rem 1.5rem 1.3rem;
    display: flex; flex-direction: column;
    text-decoration: none; color: var(--text);
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.32,0.72,0,1);
}
.dark-theme .card {
    background: rgba(17,17,17,0.5); border-color: rgba(255,255,255,0.08);
}
.card::after {
    content: ''; position: absolute; inset: 0; border-radius: 18px;
    background: radial-gradient(600px circle at var(--mx,50%) var(--my,50%), rgba(99,102,241,0.06), transparent 50%);
    opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
.card:hover::after { opacity: 1; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hv); }
.entry-card { min-height: 280px; }
.download-card { min-height: 240px; }

.card-icon-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.card-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}
.card-icon svg { width: 26px; height: 26px; }
.user-icon { background: rgba(99,102,241,0.08); color: var(--primary); }
.admin-icon { background: rgba(16,185,129,0.08); color: var(--accent); }
.dl-icon { background: rgba(245,158,11,0.08); color: var(--dl); }

.card-body { flex: 1; text-align: center; }
.card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.4rem; }
.card-desc { font-size: 0.87rem; color: var(--text-dim); line-height: 1.55; }

.card-footer { margin-top: 1rem; text-align: center; }
.card-link {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.85rem; font-weight: 600; color: var(--primary);
    transition: gap 0.2s;
}
.card:hover .card-link { gap: 0.5rem; }
.btn-row { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* ---- 按钮 ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.6rem 1.3rem; border-radius: 10px; border: none;
    font-size: 0.84rem; font-weight: 600; cursor: pointer;
    text-decoration: none; white-space: nowrap;
    transition: all 0.2s;
}
.btn-primary { background: var(--dl); color: #fff; }
.btn-primary:hover { background: var(--dl-h); box-shadow: 0 4px 16px rgba(245,158,11,0.3); transform: translateY(-1px); }
.btn-outline {
    background: transparent; color: var(--text-dim);
    border: 1.5px solid var(--card-bdr);
}
.btn-outline:hover { border-color: var(--dl); color: var(--dl); }
.modal-close-btn { background: var(--dl); color: #fff; width: 100%; margin-top: 0.5rem; border-radius: 10px; padding: 0.6rem; }
.modal-close-btn:hover { background: var(--dl-h); }

/* ---- 导航 ---- */
.page-nav {
    position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 20;
    cursor: pointer; user-select: none;
}
.nav-inner {
    display: flex; align-items: center; gap: 0.7rem;
    background: rgba(255,255,255,0.45); border: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    padding: 0.6rem 1.4rem; border-radius: 999px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}
.dark-theme .nav-inner {
    background: rgba(17,17,17,0.5); border-color: rgba(255,255,255,0.08);
}
.nav-inner:hover { box-shadow: var(--shadow-hv); }
.nav-text { color: var(--text); font-size: 0.85rem; font-weight: 500; }
.nav-arrow svg { width: 20px; height: 20px; color: var(--text); transition: transform 0.5s; }
.page-container.flipped .nav-arrow svg { transform: rotate(180deg); }

/* ---- 底部 ---- */
.page-footer { margin-top: 2rem; text-align: center; color: var(--text-dim); font-size: 0.8rem; z-index: 1; }

/* ---- 弹窗 ---- */
.tutorial-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: none; align-items: center; justify-content: center; padding: 1rem;
}
.tutorial-modal.active { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content {
    position: relative; z-index: 1;
    background: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.3); border-radius: 18px;
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    width: 100%; max-width: 500px; max-height: 85vh; overflow-y: auto;
    padding: 1.6rem; box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    animation: popIn 0.25s ease;
}
.dark-theme .modal-content {
    background: rgba(17,17,17,0.6); border-color: rgba(255,255,255,0.1);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; border-radius: 8px; transition: all 0.2s; }
.modal-close:hover { color: var(--text); }
.tutorial-steps { display: flex; flex-direction: column; gap: 0.9rem; }
.step { display: flex; gap: 0.7rem; align-items: flex-start; }
.step-num {
    min-width: 28px; height: 28px; border-radius: 50%;
    background: var(--dl); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.82rem; flex-shrink: 0;
}
.step h4 { margin: 0 0 0.15rem; font-size: 0.95rem; }
.step p { margin: 0; font-size: 0.85rem; color: var(--text-dim); line-height: 1.45; }
.modal-footer { padding-top: 1rem; border-top: 1px solid var(--card-bdr); margin-top: 1rem; text-align: center; }

/* ---- 手机端 ---- */
@media (max-width: 767px) {
    .page-container { min-height: 100vh; overflow-y: auto; padding-bottom: 2rem; }
    .page { position: static; height: auto; padding: 1rem 0.6rem; display: flex; flex-direction: column; align-items: center; margin-bottom: 2rem; }
    .page-nav { display: none; }
    .page-header { margin-bottom: 1.2rem; }
    .page-title { font-size: 1.5rem; }
    .page-subtitle { font-size: 0.82rem; }
    .card-grid { max-width: 320px; gap: 0.9rem; }
    .entry-grid, .download-grid { grid-template-columns: 1fr; }
    .card { padding: 1.3rem 1rem; border-radius: 14px; min-height: auto; }
    .card-icon { width: 48px; height: 48px; border-radius: 12px; }
    .card-icon svg { width: 22px; height: 22px; }
    .card-title { font-size: 1.05rem; }
    .card-desc { font-size: 0.8rem; }
    .btn { padding: 0.5rem 0.9rem; font-size: 0.8rem; border-radius: 8px; }
    .theme-toggle { top: 0.7rem; right: 0.7rem; width: 38px; height: 38px; border-radius: 10px; }
    .modal-content { max-width: 300px; padding: 1.1rem; }
}