/* ===== 33图库 iOS 风格设计系统 ===== */

:root {
    --bg: #F2F2F7;
    --card: #FFFFFF;
    --text: #1C1C1E;
    --text2: #8E8E93;
    --text3: #AEAEB2;
    --sep: #E5E5EA;
    --blue: #007AFF;
    --red: #FF3B30;
    --green: #34C759;
    --orange: #FF9500;
    --purple: #AF52DE;
    --tint: #07c160;
    --bar-bg: rgba(249, 249, 249, 0.94);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --max-w: 480px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(56px + var(--safe-bottom));
}

a { color: var(--tint); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input { font-family: inherit; font-size: inherit; }

/* ===== 布局容器 ===== */
.page { max-width: var(--max-w); margin: 0 auto; position: relative; }
.page-content { padding: 0 5px calc(68px + var(--safe-bottom)); }
.page-content.with-nav { padding-top: 56px; }

/* ===== 导航栏 ===== */
.nav-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 50px; display: flex; align-items: center; padding: 0px;
    background: var(--bar-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid var(--sep);
    max-width: var(--max-w); margin: 0 auto;
}
.nav-back {
    width: 40px; height: 40px; border: none; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: var(--tint);
    flex-shrink: 0; border-radius: 50%; transition: background 0.2s; z-index: 1;
}
.nav-back:active { background: rgba(0,0,0,0.05); }
.nav-back svg { width: 22px; height: 22px; }
.nav-title {
    position: absolute; left: 50px; right: 50px; text-align: center;
    font-size: 17px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}
.nav-right {
    position: absolute; right: 8px;
    display: flex; align-items: center; gap: 8px; z-index: 1;
}
.nav-right a {
    font-size: 13px; color: var(--tint); font-weight: 500;
    padding: 5px 10px; background: rgba(7,193,96,0.08); border-radius: 14px;
}

/* ===== TabBar ===== */
.tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: calc(58px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.98) 100%);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: none;
    box-shadow: 0 -1px 12px rgba(0,0,0,0.06), 0 -0.5px 0 rgba(0,0,0,0.05);
    display: flex;
    max-width: var(--max-w); margin: 0 auto;
}
.tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; color: #999; text-decoration: none;
    font-size: 14px; gap: 3px; transition: all 0.25s;
    padding: 4px 0;
    position: relative;
}
.tab-item:active { transform: scale(0.9); }
.tab-item.active { color: var(--tint); }
.tab-icon {
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.25s;
}
.tab-item.active .tab-icon { transform: scale(1.08); }
.tab-icon svg { width: 100%; height: 100%; }
.tab-label {
    line-height: 1; font-weight: 500; letter-spacing: 0.3px;
}
.tab-item.active .tab-label { font-weight: 600; }
.tab-dot {
    position: absolute; top: 3px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%;
}

/* ===== 搜索栏 ===== */
.search-bar {
    display: flex; gap: 0; padding: 8px 0;
}
.search-input {
    flex: 1; height: 38px; border: 2px solid var(--tint); border-right: none;
    border-radius: 19px 0 0 19px;
    background: #f0f5f1; padding: 0 14px; font-size: 15px;
    outline: none; -webkit-appearance: none; color: var(--tint);
}
.search-input::placeholder { color: var(--text3); }
.search-btn {
    height: 38px; padding: 0 20px; border: none; border-radius: 0 19px 19px 0;
    background: var(--tint); color: #fff; font-size: 15px; font-weight: 500;
    cursor: pointer; white-space: nowrap; transition: opacity 0.2s;
}
.search-btn:active { opacity: 0.7; }

/* ===== 公告 ===== */
.notice-bar {
    display: flex; align-items: center; gap: 6px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
    padding: 5px 10px;
    margin-bottom: 5px;
    font-size: 14px;
    overflow: hidden;
}
.notice-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 8px;
    background: linear-gradient(180deg, #f0f4fa 0%, #e5ebf3 100%);
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
}
.notice-icon svg { width: 100%; height: 100%; }
.notice-content { overflow: hidden; flex: 1;line-height: 14px; }
.notice-content marquee { color: #0f172a; font-weight: 500; }

/* ===== Tabs ===== */
.tabs {
    display: flex; gap: 0; background: var(--card); border-radius: var(--radius-sm);
    padding: 3px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.tab-btn {
    flex: 1; height: 34px; border: none; border-radius: 5px;
    background: transparent; color: var(--text2); font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.25s ease;
}
.tab-btn.active {
    background: var(--tint); color: #fff;
    box-shadow: 0 2px 8px rgba(7,193,96,0.3);
}

/* ===== 卡片 ===== */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden;
}
.card-header { padding: 14px 16px 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 12px 16px; }
.card-footer { padding: 0 16px 12px; display: flex; justify-content: flex-end; gap: 8px; }

/* ===== 快捷入口图标 ===== */
.quick-nav {
    display: flex; justify-content: space-around; align-items: flex-start;
    padding: 14px 8px; margin-bottom: 10px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.quick-nav-item {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: var(--text); padding: 4px 0;
    width: 64px;
}
.quick-nav-item:active .quick-nav-icon { transform: scale(0.9); }
.quick-nav-icon {
    width: 48px; height: 48px; border-radius: 14px; margin-bottom: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: transform 0.2s;
}
.quick-nav-icon svg { width: 24px; height: 24px; }
.quick-nav-label { font-size: 12px; color: #444; text-align: center; line-height: 1.3; font-weight: 500; }
.quick-nav-item:nth-child(1) .quick-nav-icon { background: linear-gradient(135deg, #43e97b, #38d9a9); }
.quick-nav-item:nth-child(2) .quick-nav-icon { background: linear-gradient(135deg, #667eea, #764ba2); }
.quick-nav-item:nth-child(3) .quick-nav-icon { background: linear-gradient(135deg, #f5af19, #f12711); }
.quick-nav-item:nth-child(4) .quick-nav-icon { background: linear-gradient(135deg, #4facfe, #00f2fe); }

/* ===== 广告链接 ===== */
.link-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    margin-bottom: 12px;
}
.link-item {
    background: var(--card); border-radius: var(--radius-sm); padding: 10px 4px;
    text-align: center; text-decoration: none; color: var(--tint);
    box-shadow: var(--shadow); font-size: 13px; font-weight: 600;
    transition: transform 0.2s;
}
.link-item:active { transform: scale(0.95); }

/* ===== 图库瀑布流（JS双列） ===== */
.gallery-grid {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.gallery-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.gallery-card {
    display: block;
    background: var(--card); border-radius: var(--radius-sm); overflow: hidden;
    box-shadow: var(--shadow); text-decoration: none; color: var(--text);
    transition: transform 0.2s;
}
.gallery-card:active { transform: scale(0.97); }
.gallery-img {
    width: 100%; height: auto; display: block;
    min-height: 120px;
    transition: opacity 0.3s;
    background: #f0f0f0 url("../uploading.png") center center no-repeat;
    background-size: 100% auto;
}
.gallery-img.lazy { opacity: 0; }
.gallery-img.loaded { background: none; min-height: 0; }
.gallery-img.img-error {
    min-height: 120px;
    background: #f5f5f5 url("../uploading.png") center center no-repeat;
    background-size: 100% auto;
}
.gallery-title {
    font-size: 16px; font-weight: bold; padding: 10px 10px;
    text-align: center; color: var(--tint);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.4;
}

/* ===== 彩球 ===== */
.balls-row { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.ball-wrap { text-align: center; }
.ball {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    font-size: 16px; font-weight: 700; color: #fff;
    box-shadow: inset 0 -3px 6px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1);
}
.ball-red { background: linear-gradient(135deg, #FF6B6B, #E63946); }
.ball-blue { background: linear-gradient(135deg, #74B9FF, #3399FF); }
.ball-green { background: linear-gradient(135deg, #7BED9F, #2ED573); }
.ball-gray { background: linear-gradient(135deg, #BDC3C7, #95A5A6); }
.ball-sub { display: block; font-size: 10px; color: var(--text2); margin-top: 2px; line-height: 1; }
.ball-plus {
    font-size: 20px; font-weight: 300; color: var(--text3); padding: 0 4px;
    display: flex; align-items: center;
}

/* ===== 开奖卡片 ===== */
.lottery-card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px 12px; margin-bottom: 12px;
}
.lottery-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; font-size: 13px;
}
.lottery-label { font-weight: 600; font-size: 15px; }
.lottery-period { color: var(--red); font-weight: 600; }
.lottery-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 10px; font-size: 12px; color: var(--text2);
}
.lottery-link { font-size: 13px; color: var(--tint); font-weight: 500; }

/* ===== 列表 ===== */
.list-group {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden;
}
.list-item {
    display: flex; align-items: center; padding: 12px 16px;
    border-bottom: 0.5px solid var(--sep); text-decoration: none; color: var(--text);
    transition: background 0.15s;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: rgba(0,0,0,0.03); }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 15px; font-weight: 500; }
.list-item-sub { font-size: 13px; color: var(--text2); margin-top: 2px; }
.list-item-arrow { color: var(--text3); margin-left: 8px; flex-shrink: 0; }
.list-item-arrow::after { content: '\203A'; font-size: 20px; font-weight: 300; }

/* ===== 历史记录表 ===== */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
    background: var(--tint); color: #fff; padding: 8px 4px;
    font-weight: 600; font-size: 12px; text-align: center;
}
.history-table td {
    padding: 8px 4px; text-align: center; border-bottom: 0.5px solid var(--sep);
}
.history-table .ball { width: 28px; height: 28px; font-size: 12px; }

/* ===== 推荐表格 ===== */
.rec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rec-table th {
    background: var(--tint); color: #fff; padding: 10px 8px;
    font-weight: 600; text-align: center;
}
.rec-table td {
    padding: 8px; text-align: center; border-bottom: 0.5px solid var(--sep);
}
.badge-ok {
    display: inline-block; padding: 2px 10px; background: var(--green);
    color: #fff; border-radius: 12px; font-size: 12px; font-weight: 600;
}

/* ===== 文章 ===== */
.article-body {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px 16px; margin-bottom: 12px; line-height: 1.8; font-size: 15px;
}
.article-body img {
    border-radius: var(--radius-sm); margin: 10px 0;
    min-height: 80px;
    background: #f0f0f0 url("../uploading.png") center center no-repeat;
    background-size: 100% auto;
}
.article-meta {
    display: flex; gap: 16px; font-size: 12px; color: var(--text2);
    padding: 8px 0; margin-bottom: 10px;
}

/* ===== 视频 ===== */
.video-player {
    background: #000; border-radius: var(--radius); overflow: hidden;
    margin-bottom: 12px;
}
.video-player video { width: 100%; display: block; }
.video-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.video-card {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); text-decoration: none; color: var(--text);
}
.video-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--bg); }
.video-card-info { padding: 8px 10px; font-size: 13px; }

/* ===== 工具 ===== */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tool-card {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 10px; text-align: center; text-decoration: none; color: var(--text);
    transition: transform 0.2s;
}
.tool-card:active { transform: scale(0.95); }
.tool-icon { font-size: 28px; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; }
.tool-icon svg { width: 28px; height: 28px; color: var(--tint); }
.tool-label { font-size: 13px; font-weight: 500; }

/* ===== 推荐站点 ===== */
.site-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.site-item {
    background: var(--card); border-radius: var(--radius-sm); padding: 12px 4px;
    text-align: center; text-decoration: none; color: var(--text);
    box-shadow: var(--shadow); font-size: 13px; font-weight: 500;
    transition: transform 0.2s;
}
.site-item:active { transform: scale(0.95); }

/* ===== 分区标题 ===== */
.section-title {
    font-size: 16px; font-weight: 700; margin: 14px 0 6px; color: var(--text);
    display: flex; align-items: center; gap: 6px;
}
.section-title svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ===== 骨架屏 ===== */
.skeleton-card {
    background: var(--card); border-radius: var(--radius-sm); overflow: hidden;
    box-shadow: var(--shadow);
}
.skeleton-img { width: 100%; height: 140px; }
.skeleton-text { height: 16px; margin: 10px auto; border-radius: 4px; width: 60%; }
.skeleton-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-icon { margin-bottom: 12px; display: flex; justify-content: center; }
.empty-icon svg { width: 48px; height: 48px; color: var(--text3); }

/* ===== Toast ===== */
.toast-msg {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0,0,0,0.75); color: #fff; padding: 10px 24px;
    border-radius: 10px; font-size: 14px; z-index: 9999;
    opacity: 0; transition: all 0.3s ease; pointer-events: none;
}
.toast-msg.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ===== 加载更多 ===== */
.load-more { text-align: center; padding: 16px; font-size: 13px; color: var(--text2); }
.spinner {
    display: inline-block; width: 20px; height: 20px;
    border: 2px solid var(--sep); border-top-color: var(--tint);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 刷新按钮 ===== */
.refresh-btn {
    border: none; background: var(--tint); color: #fff;
    padding: 6px 16px; border-radius: 16px; font-size: 13px;
    cursor: pointer; transition: opacity 0.2s;
}
.refresh-btn:active { opacity: 0.7; }

/* ===== 图片详情 ===== */
.pic-detail-img {
    width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-md);
    margin-bottom: 12px;
}
.pic-period-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pic-period-btn {
    padding: 6px 12px; border-radius: 16px; border: 1px solid var(--sep);
    background: var(--card); font-size: 13px; color: var(--text);
    cursor: pointer; transition: all 0.2s;
}
.pic-period-btn.active { background: var(--tint); color: #fff; border-color: var(--tint); }

/* ===== 选择器 ===== */
.select-wrap { position: relative; display: inline-block; }
.select-native {
    appearance: none; -webkit-appearance: none;
    background: var(--card); border: 1px solid var(--sep);
    border-radius: var(--radius-sm); padding: 8px 32px 8px 12px;
    font-size: 14px; color: var(--text); cursor: pointer;
}
.select-wrap::after {
    content: '\25BE'; position: absolute; right: 12px; top: 50%;
    transform: translateY(-50%); color: var(--text2); pointer-events: none;
}

/* ===== KJ 开奖组件 ===== */
.kj-frame {
    width: 100%; border: none; height: 122px; display: block;
    border-radius: 10px; overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
@media only screen and (max-width: 420px) { .kj-frame { height: 115px; } }
@media only screen and (max-width: 400px) { .kj-frame { height: 110px; } }
@media only screen and (max-width: 350px) { .kj-frame { height: 100px; } }
@media only screen and (max-width: 320px) { .kj-frame { height: 100px; } }

.kj-tab-bar {
    display: flex; gap: 0; margin-top: 6px; margin-bottom: 8px;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.kj-tab-btn {
    flex: 1; height: 38px; border: none; cursor: pointer;
    background: #07c160; color: #fff; font-size: 15px; font-weight: 700;
    border-radius: 0; transition: opacity 0.2s;
}
.kj-tab-btn:first-child { border-radius: 0; }
.kj-tab-btn:last-child { border-radius: 0; }
.kj-tab-btn:not(:last-child) { border-right: 1px solid rgba(255,255,255,0.3); }
.kj-tab-btn.active { background: #059c4c; }
.kj-tab-btn:active { opacity: 0.7; }

@media screen and (max-width: 400px) {
    .kj-ball-num { font-size: 14px; }
    .kj-tit { font-size: 12px; }
    .kj-lotto { font-size: 12px; }
}

/* ===== 首页分区图标（原版风格） ===== */
.home-icon-row {
    display: flex; justify-content: space-between; padding: 6px 0;
}
.home-icon-item {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: var(--text); width: 25%; padding: 4px 0;
}
.home-icon-item:active { opacity: 0.7; }
.home-icon-img {
    width: 48px; height: 48px; border-radius: 12px; margin-bottom: 4px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.home-icon-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.home-icon-img svg { width: 28px; height: 28px; }
.home-icon-label { font-size: 12px; color: #333; text-align: center; }

/* ===== 首页链接列表（原版风格） ===== */
.home-link-list {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    margin: 8px 0 12px;
}
.home-link-item {
    background: #fff; border: 1px solid #eee; border-radius: 8px;
    padding: 8px 4px; text-align: center; text-decoration: none;
    color: var(--tint); font-size: 13px; font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); transition: transform 0.2s;
}
.home-link-item:active { transform: scale(0.95); }

/* ===== 动画 ===== */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
