/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 58px;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: hidden;
}

/* 头部 */
.header {
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
    max-width: 100%;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    max-width: 100%;
    height: auto;
    max-height: 50px;
    object-fit: contain;
}

/* 分类标签 */
.category-tabs {
    display: flex;
    overflow-x: auto;
    padding: 8px 15px;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab {
    padding: 6px 14px;
    background: #f0f0f0;
    border-radius: 16px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    color: #666;
    border: 1px solid #e0e0e0;
}
.category-tab.active {
    background: linear-gradient(180deg, #c79863 0%, #b07b44 100%);
    color: #fff;
    border-color: #b07b44;
}
.category-tab:active { transform: scale(0.95); }

/* 主体 */
.main {
    padding: 0;
    max-width: 100%;
    margin: 0;
    background: #f5f5f5;
    width: 100%;
}
.page { animation: fadeIn 0.3s; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 游戏列表 */
.games-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
}
.game-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 100%;
}
.game-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.game-main-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: #ffffff;
}
.game-icon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.game-icon-wrapper {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.game-name-below-icon {
    font-size: 12px !important;
    color: #666 !important;
    text-align: center !important;
    max-width: 80px !important;
    line-height: 1.3 !important;
    word-break: break-all !important;
    font-weight: 500 !important;
    display: block !important;
    margin-top: 4px !important;
    white-space: normal !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    min-height: 14px !important;
}
.game-icon-img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    padding: 0;
    box-sizing: border-box;
    min-width: 100%;
    min-height: 100%;
}
.game-icon-wrapper img[src$=".svg"] {
    width: 100%;
    height: 100%;
    padding: 0;
    object-fit: fill;
    box-sizing: border-box;
    min-width: 100%;
    min-height: 100%;
}
.game-icon-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #4a90e2, #357abd);
}

.game-right-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.game-period-info {
    display: flex;
    flex-direction: row;
    gap: 15px;
    font-size: 13px;
    align-items: center;
    flex-wrap: nowrap;
}
@media (max-width: 400px) {
    .game-period-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .game-period-info .period-text { width: 100%; }
}
.period-text { color: #333; font-weight: 500; white-space: nowrap; }
.period-value { color: #ff4444; font-weight: bold; }

.game-numbers-section { padding: 5px 0 0 0; background: #ffffff; }
.result-numbers {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
    min-height: 26px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.result-numbers::-webkit-scrollbar {
    display: none;
}
.number-ball {
    flex-shrink: 0;
    min-width: 20px;
    width: auto;
    height: 26px;
    aspect-ratio: 1;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    position: relative;
    border: none;
    transition: transform 0.2s;
    padding: 0 2px;
    box-sizing: border-box;
    white-space: nowrap;
    text-shadow:
        -1px -1px 0 #000,
        0 -1px 0 #000,
        1px -1px 0 #000,
        -1px 0 0 #000,
        1px 0 0 #000,
        -1px 1px 0 #000,
        0 1px 0 #000,
        1px 1px 0 #000,
        0 0 1px #000,
        0 0 2px #000;
}
.number-ball[class*="racing-num-"] {
    color: #ffffff !important;
    font-weight: bold !important;
    border: none !important;
}

/* 六合彩号码样式 - 使用图片背景 */
.number-ball.lhc-red,
.number-ball.lhc-blue,
.number-ball.lhc-green {
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    color: #000 !important;
    font-weight: bold !important;
    text-shadow: none !important;
    border: none !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    /* 使用百分比padding，适配不同设备 */
    padding-top: 3% !important;
    padding-left: 15% !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
}

.number-ball:active { transform: scale(0.95); }

/* 游戏底部 */
.game-footer-section {
    background: rgb(233, 191, 149);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.countdown-section { display: flex; align-items: baseline; gap: 5px; }
.countdown-time-wrapper { display: flex; align-items: flex-start; gap: 4px; }
.countdown-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.countdown-number {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    line-height: 1;
    height: 20px;
    display: flex;
    align-items: center;
}
.countdown-label { font-size: 12px; color: #666; line-height: 1; }
.countdown-status { display: flex; align-items: center; justify-content: center; }
.countdown-status-text { font-size: 14px; color: #888888; font-weight: bold; }
.countdown-separator {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    line-height: 1;
    height: 20px;
    display: flex;
    align-items: center;
}

.game-actions { display: flex; gap: 0; align-items: center; }
.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    cursor: pointer;
}
.action-btn svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }
.action-divider {
    width: 1px;
    height: 28px;
    align-self: center;
    background: #8a5a1f;
    flex-shrink: 0;
    margin: 0 6px;
}
.action-btn:hover { color: #4a90e2; background: rgba(74, 144, 226, 0.1); }
.action-btn:active { transform: scale(0.95); }

/* 历史开奖页面 */
#historyPage {
    background: #fff;
    min-height: 100vh;
    padding-bottom: 60px;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
}

/* 历史页面头部 */
.history-header {
    background: linear-gradient(180deg, #c79863 0%, #b07b44 100%);
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: 100%;
}
.history-header-title {
    flex: 1;
    text-align: center;
    letter-spacing: 1px;
}
.history-header-menu {
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

/* 游戏和日期选择器 */
.history-selector {
    display: flex;
    background: #fff;
    padding: 12px 16px;
    gap: 12px;
    border-bottom: 1px solid #e0e0e0;
}
.history-game-selector,
.history-date-selector {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f8f8f8;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* 确保点击区域足够大 */
    user-select: none; /* 防止文本选择 */
}
.history-game-selector:active,
.history-date-selector:active {
    background: #f0f0f0;
}
.selector-label {
    font-size: 14px;
    color: #333;
    flex: 1;
    text-align: left;
    pointer-events: none;
    user-select: none;
    position: relative;
    z-index: 1;
}
.selector-arrow {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
    pointer-events: none; /* 设置为none，让容器统一处理点击 */
    user-select: none;
    cursor: pointer;
    flex-shrink: 0; /* 防止图标被压缩 */
    position: relative;
    z-index: 1;
}

/* 隐藏的原生选择器，但保持可用 - 覆盖整个选择器区域（包括边框） */
#historyGameSelect,
#historyDate {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    font-size: 16px; /* 防止iOS缩放 */
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

/* 当前期开奖信息 */
.current-draw-section {
    background: #fff;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}
.current-draw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.current-draw-title {
    font-size: 16px;
    font-weight: bold;
    color: #8B4513; /* 深棕色 */
}
.current-draw-info {
    font-size: 13px;
    color: #999; /* 灰色 */
}
.current-draw-numbers {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    margin-bottom: 12px;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
}
.current-draw-numbers::-webkit-scrollbar {
    display: none;
}
.current-draw-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.countdown-text {
    color: #ff4444;
    font-weight: bold;
}

/* 历史内容区域 */
.history-content {
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}
.history-content-title {
    padding: 16px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

/* 标签页 */
.history-tabs {
    display: flex;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.history-tabs::-webkit-scrollbar { display: none; }
.history-tab {
    flex: 1;
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: 60px;
    position: relative;
    background: #f8f8f8;
}
.history-tab.active {
    color: #b07b44;
    font-weight: bold;
    background: #fff;
}
.history-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #b07b44;
}

/* 历史列表 */
.history-list {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}
.history-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    transition: background 0.2s;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}
.history-item:last-child {
    border-bottom: none;
}
.history-item:active {
    background: #f8f8f8;
}
.history-item-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
    flex-shrink: 0;
    align-items: flex-start;
}
.history-item-header span:first-child {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1.4;
}
.history-item-header span:last-child {
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}
.history-item-numbers {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    align-items: center;
    justify-content: flex-start;
    flex: 1;
    min-width: 0;
    min-height: 32px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.history-item-numbers::-webkit-scrollbar {
    display: none;
}

/* 按钮 */
.btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-primary { background: #4a90e2; color: #fff; border: none; }
.btn-secondary { background: #f0f0f0; color: #333; border: 1px solid #ddd; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px;
    gap: 10px;
}
.page-info { color: #666; font-size: 13px; flex: 1; text-align: center; }

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    min-height: 52px;
    width: 100%;
    max-width: 100%;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: #999;
    transition: all 0.3s;
    padding: 6px 15px;
    border-radius: 8px;
    flex: 1;
}
.nav-item.active { color: #b07b44; }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.nav-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; transition: all 0.3s; }
.nav-item.active .nav-icon svg { stroke: #b07b44; fill: none; }
.nav-label { font-size: 11px; line-height: 1.2; white-space: nowrap; }

/* 加载与空状态 */
.loading, .no-data {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}
.no-result {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* 历史标签页特殊样式 */
.history-size-ball {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.history-oddeven-ball {
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.history-pair-ball {
    transition: all 0.2s;
}

.history-pair-ball:hover {
    transform: scale(1.05);
}

.history-sum-ball {
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 香港彩生肖文本样式 */
.hk-zodiac-text {
    font-size: 10px;
    color: #666;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    font-weight: bold;
}

/* 响应式 */
@media (min-width: 768px) {
    .main { max-width: 100%; padding: 0; }
    .games-list { 
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 12px; 
        padding: 12px;
    }
    .history-controls { flex-direction: row; }
    .select-input, .date-input { flex: 1; }
    #historyPage { max-width: 100%; }
}

