/* ============================================================
   168开奖网 - 全局自定义样式
   ============================================================ */

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

a { text-decoration: none; color: inherit; }

/* 主题切换下拉动画 */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 安全区域适配 (iPhone底部) */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }

/* 公告滚动 */
@keyframes marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.notice-marquee {
    display: flex;
    gap: 3rem;
    animation: marquee 30s linear infinite;
    white-space: nowrap;
}
.notice-marquee:hover { animation-play-state: paused; }

/* 分类标签栏横向滚动 */
.category-tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1.5px solid transparent;
    color: var(--color-text-secondary);
    background: transparent;
}
.category-tab:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}
.category-tab.active {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
    font-weight: 700;
    box-shadow: 0 2px 8px var(--color-shadow);
}

/* 彩种卡片 */
.lottery-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 1rem 1.125rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.lottery-card:active { transform: scale(0.98); }
@media (hover: hover) {
    .lottery-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px var(--color-shadow);
        border-color: var(--color-primary);
    }
}

/* 号码球容器 */
.balls-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

/* 标签行 */
.tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.8125rem;
}

/* 加载动画 */
@keyframes pulse-dot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}
.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: pulse-dot 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* 开奖中闪烁 */
@keyframes blink-draw {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.drawing-text {
    animation: blink-draw 1s ease-in-out infinite;
    color: var(--color-danger);
    font-weight: 600;
}

/* Swiper 自定义 */
.home-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.5);
    opacity: 1;
}
.home-swiper .swiper-pagination-bullet-active {
    background: #fff;
    width: 20px;
    border-radius: 4px;
}

/* 彩种图标占位 */
.lottery-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.lottery-icon.pk10 { background: linear-gradient(135deg, #F97316, #FBBF24); }
.lottery-icon.ssc  { background: linear-gradient(135deg, #818CF8, #6366F1); }
.lottery-icon.ssq  { background: linear-gradient(135deg, #EF4444, #B91C1C); }
.lottery-icon.fc3d { background: linear-gradient(135deg, #F97316, #DC2626); }

/* 响应式网格 */
.lottery-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .lottery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .lottery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 详情页顶部渐变 */
.detail-hero {
    background: var(--color-header-bg);
    color: var(--color-header-text);
    padding: 1.25rem 1rem;
    border-radius: 0 0 1.5rem 1.5rem;
}

.detail-summary-card {
    background: var(--color-detail-panel-bg);
    border: 1px solid var(--color-detail-panel-border);
    box-shadow: 0 10px 24px var(--color-detail-panel-shadow);
    backdrop-filter: blur(10px);
}

.detail-summary-meta {
    color: var(--color-detail-muted);
}

.detail-summary-tags {
    color: var(--color-detail-muted);
}

.detail-summary-tags span {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.18);
}

.detail-summary-tags .font-bold {
    font-weight: 700;
}

.detail-hero #detailBalls {
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.detail-hero #detailBalls .ball-pk.l {
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.detail-hero #detailBalls .ball-ssc.l,
.detail-hero #detailBalls .ball-fc3d.l {
    width: 28px;
    height: 28px;
}

/* Tab 切换 */
.detail-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
}
.detail-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.detail-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 700;
}

/* 历史表格 */
.history-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.history-table th {
    padding: 0.4rem 0.25rem;
    text-align: center;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-card);
    z-index: 5;
}
.history-table td {
    padding: 0.35rem 0.25rem;
    text-align: center;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}
.history-table tr:last-child td { border-bottom: none; }

.history-table-pk10 th,
.history-table-pk10 td {
    white-space: nowrap;
    border-right: 1px solid var(--color-border-light);
}

.history-table-pk10 {
    --ball-pk-xs-size: 28px;
    --ball-pk-xs-radius: 3px;
}

.history-table-pk10 th:last-child,
.history-table-pk10 td:last-child {
    border-right: none;
}

.history-table-pk10 th {
    background: #f3f4f6;
    font-size: 14px;
    font-weight: 700;
    color: #7c8594;
    padding: 0.45rem 0.25rem;
}

.history-table-pk10 td {
    height: 30px;
    padding: 0.02rem 0.14rem;
}

.history-table-pk10 tbody tr:nth-child(odd) td {
    background: #ffffff;
}

.history-table-pk10 tbody tr:nth-child(even) td {
    background: #e9e9e9;
}

.history-table-ssc th,
.history-table-ssc td {
    white-space: nowrap;
    border-right: 1px solid var(--color-border-light);
}

.history-table-ssc {
    --ball-ssc-xs-size: 26px;
}

.history-table-ssc th:last-child,
.history-table-ssc td:last-child {
    border-right: none;
}

.history-table-ssc th {
    background: #f3f4f6;
    font-size: 14px;
    font-weight: 700;
    color: #7c8594;
    padding: 0.45rem 0.25rem;
}

.ssc-col-time { width: 170px; }
.ssc-col-issue { width: 110px; }
.ssc-col-balls { width: 220px; }
.ssc-col-sum { width: 64px; }
.ssc-col-side { width: 52px; }
.ssc-col-dt { width: 64px; }

.history-table-ssc td {
    height: 30px;
    padding: 0.02rem 0.14rem;
}

.history-table-ssc tbody tr:nth-child(odd) td {
    background: #ffffff;
}

.history-table-ssc tbody tr:nth-child(even) td {
    background: #e9e9e9;
}

.ssc-mode-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1px 0;
}

.ssc-mode-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ssc-mode-btn {
    min-width: 68px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid #cfd3da;
    border-radius: 4px;
    background: #ffffff;
    color: #8a8f99;
    font-size: 12px;
    font-weight: 600;
    line-height: 26px;
    cursor: pointer;
}

.ssc-mode-btn.active {
    background: #565a69;
    border-color: #565a69;
    color: #fff;
}

.ssc-history-balls {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    width: 200px;
    min-height: var(--ball-ssc-xs-size);
    margin: 0 auto;
}

.ssc-history-tags {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 200px;
    min-height: var(--ball-ssc-xs-size);
    margin: 0 auto;
}

.ssc-history-tag {
    width: var(--ball-ssc-xs-size);
    height: var(--ball-ssc-xs-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 400;
    color: #fff;
    background: #8d98b8;
}

.ssc-history-tag.big,
.ssc-history-tag.odd {
    background: #f4a037;
}

.ssc-history-tag.small,
.ssc-history-tag.even {
    background: #8d98b8;
}

.ssc-sum-value {
    color: #F97316;
    font-weight: 400;
    font-size: 18px;
    line-height: 1;
}

.ssc-cell-time,
.ssc-cell-issue {
    font-size: 14px;
    font-weight: 400;
    color: #000;
}

.ssc-cell-time {
    width: 170px;
    padding-left: 6px !important;
    padding-right: 4px !important;
}

.ssc-cell-issue {
    width: 110px;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.ssc-cell-balls {
    padding: 0 !important;
    line-height: 0;
    width: 220px;
    text-align: center;
}

.ssc-cell-side,
.ssc-cell-dt {
    font-size: 16px;
    line-height: 1;
    text-align: left;
    padding-left: 6px !important;
    padding-right: 2px !important;
}

.ssc-cell-side span,
.ssc-cell-dt span {
    font-weight: 400 !important;
}

.ssc-cell-sum {
    width: 64px;
    text-align: left;
    padding-left: 6px !important;
    padding-right: 2px !important;
}

.pk10-mode-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 1px 0;
}

.pk10-mode-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    line-height: 1;
}

.pk10-mode-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pk10-mode-btn {
    min-width: 68px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid #cfd3da;
    border-radius: 4px;
    background: #ffffff;
    color: #8a8f99;
    font-size: 12px;
    font-weight: 600;
    line-height: 26px;
    cursor: pointer;
}

.pk10-mode-btn.active {
    background: #565a69;
    border-color: #565a69;
    color: #fff;
}

.pk10-history-balls {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    min-width: 292px;
    min-height: 28px;
}

.pk10-history-tags {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 292px;
    min-height: 28px;
}

.pk10-history-tag {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 400;
    color: #fff;
    background: #8d98b8;
}

.pk10-history-tag.big,
.pk10-history-tag.odd {
    background: #f4a037;
    color: #fff;
}

.pk10-history-tag.small,
.pk10-history-tag.even {
    background: #8d98b8;
    color: #fff;
}

.pk10-sum-value {
    color: #F97316;
    font-weight: 400;
    font-size: 18px;
    line-height: 1;
}

.pk10-cell-time,
.pk10-cell-issue {
    font-size: 14px;
    font-weight: 400;
    color: #000;
}

.pk10-cell-balls {
    padding: 0 !important;
    line-height: 0;
}

.pk10-cell-side,
.pk10-cell-dt {
    font-size: 16px;
    line-height: 1;
}

.pk10-cell-side span,
.pk10-cell-dt span {
    font-weight: 400 !important;
}

/* 脉冲呼吸指示灯 */
@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
    70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22C55E;
    display: inline-block;
    animation: live-pulse 2s infinite;
}

/* 响应式微调 */
@media (max-width: 639px) {
    .balls-row .ball-pk, .balls-row .ball-ssc, .balls-row .ball-fc3d { width: 24px; height: 24px; font-size: 11px; }
    .tags-row { font-size: 0.75rem; }
    .detail-hero #detailBalls {
        gap: 1px;
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    .detail-hero #detailBalls .ball-pk.l {
        width: 28px;
        height: 28px;
        border-radius: 4px;
    }
    .history-table-pk10 {
        --ball-pk-xs-size: 24px;
    }
    .pk10-mode-switcher { gap: 4px; }
    .pk10-mode-btn { min-width: 60px; height: 24px; padding: 0 8px; font-size: 11px; line-height: 22px; }
    .pk10-history-balls,
    .pk10-history-tags { min-width: 272px; min-height: 24px; }
    .pk10-history-tag { width: 24px; height: 24px; font-size: 12px; border-radius: 3px; }
    .history-table-pk10 th { font-size: 13px; }
    .history-table-pk10 td { height: 28px; padding: 0.01rem 0.1rem; }
    .pk10-cell-time,
    .pk10-cell-issue { font-size: 12px; }
    .pk10-sum-value { font-size: 16px; }
    .pk10-cell-side,
    .pk10-cell-dt { font-size: 14px; }

    .history-table-ssc {
        --ball-ssc-xs-size: 22px;
    }
    .ssc-col-time { width: 138px; }
    .ssc-col-issue { width: 96px; }
    .ssc-col-balls { width: 180px; }
    .ssc-col-sum { width: 52px; }
    .ssc-col-side { width: 46px; }
    .ssc-col-dt { width: 56px; }
    .ssc-mode-switcher { gap: 4px; }
    .ssc-mode-btn { min-width: 60px; height: 24px; padding: 0 8px; font-size: 11px; line-height: 22px; }
    .ssc-history-balls,
    .ssc-history-tags { width: 168px; min-height: var(--ball-ssc-xs-size); }
    .ssc-history-tag { width: var(--ball-ssc-xs-size); height: var(--ball-ssc-xs-size); font-size: 11px; }
    .history-table-ssc th { font-size: 13px; }
    .history-table-ssc td { height: 28px; padding: 0.01rem 0.1rem; }
    .ssc-cell-time,
    .ssc-cell-issue { font-size: 12px; }
    .ssc-cell-time { width: 138px; padding-left: 4px !important; }
    .ssc-cell-issue { width: 96px; padding-left: 2px !important; }
    .ssc-cell-balls { width: 180px; }
    .ssc-sum-value { font-size: 16px; }
    .ssc-cell-side,
    .ssc-cell-dt { font-size: 14px; }
    .ssc-cell-sum { width: 52px; padding-left: 4px !important; }
}
