/* 赛马押宝页面样式 */

.horse-racing-page {
    --text: #f0f4f8;
    --text-secondary: #8b9cb3;
    --border: rgba(255, 255, 255, 0.12);
    --radius: 14px;
    --glass: rgba(26, 35, 50, 0.85);
    --glass-border: rgba(255, 215, 0, 0.2);
    --primary: #ffd700;
}

.horse-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 12px 160px;
}

.horse-stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.horse-stat-cell {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.horse-stat-cell.highlight {
    grid-column: 1 / -1;
}

.horse-stat-cell.status-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.horse-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.horse-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffd700;
}

.horse-stat-value.pool {
    color: #ff6b6b;
}

.horse-stat-value.timer {
    font-family: ui-monospace, monospace;
    font-size: 1.35rem;
    color: #00d9ff;
    font-variant-numeric: tabular-nums;
}

.horse-bet-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(12, 18, 32, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 215, 0, 0.25);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}

.horse-bet-dock .dock-hint {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

.horse-bet-dock .dock-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;
    scrollbar-width: none;
}

.horse-bet-dock .dock-chips::-webkit-scrollbar {
    display: none;
}

.horse-bet-dock .act-chip {
    flex: 0 0 auto;
}

.horse-bet-dock .act-chip.active,
.horse-bet-dock .quick-amount-btn.active {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    border-color: #ffd700;
    color: #1a1a2e;
}

.horse-bet-dock .bet-btn {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #1a1a2e;
}

.horse-bet-dock .bet-btn:disabled {
    opacity: 0.45;
}

.btn-refresh {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}

.horse-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== 顶部信息栏 ========== */
.horse-header {
    background: linear-gradient(90deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.horse-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.horse-header .header-title {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
}

.horse-header .header-divider {
    color: rgba(255, 255, 255, 0.2);
}

.horse-header .period-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.horse-header .period-text strong {
    color: #fff;
    font-weight: bold;
}

.horse-header .header-center {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

.horse-header .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.horse-header .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.horse-header .stat-value {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
}

.horse-header .stat-value.pool {
    color: #ff6b6b;
}

.horse-header .stat-value.timer {
    color: #00d9ff;
    font-family: monospace;
    font-size: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 10px;
    border-radius: 4px;
}

.horse-header .stat-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.horse-header .header-right {
    flex-shrink: 0;
}

.horse-header .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.horse-header .status-badge.betting {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.4), rgba(40, 167, 69, 0.2));
    color: #5fd068;
    border: 1px solid rgba(40, 167, 69, 0.5);
}

.horse-header .status-badge.closed {
    background: rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
    border: 1px solid rgba(220, 53, 69, 0.4);
}

/* ========== 马匹押注区 ========== */
.horse-betting-section {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.horse-betting-section .section-header {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.horse-betting-section .section-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
}

.horse-betting-content {
    padding: 15px;
}

/* 马匹列表 */
.horse-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
}

.horse-card {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.horse-card:hover {
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.horse-card.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.horse-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.horse-card.disabled:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.horse-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.horse-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 5px;
}

.horse-odds {
    font-size: 12px;
    color: var(--text-secondary);
}

.horse-bet-amount {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.horse-bet-amount .amount-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.horse-bet-amount .amount-value {
    font-size: 16px;
    font-weight: bold;
    color: #ff6b6b;
}

.horse-card .my-bet {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #00d9ff, #007bff);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
}

/* 押注操作区 */
.bet-action-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.bet-amount-input {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.bet-amount-input .quick-amounts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-amount-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amount-btn:hover {
    border-color: #ffd700;
    color: #ffd700;
}

.quick-amount-btn.active {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    border-color: #ffd700;
}

.bet-input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bet-input-wrapper input {
    width: 120px;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 16px;
    text-align: center;
}

.bet-input-wrapper input:focus {
    outline: none;
    border-color: #ffd700;
}

.bet-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.bet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.bet-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========== 往期记录区 ========== */
.horse-history-section {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.horse-history-section .section-header {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.horse-history-section .section-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
}

.history-tabs {
    display: flex;
    gap: 10px;
}

.history-tab {
    padding: 6px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.history-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--dark);
    border-color: var(--primary);
}

.history-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

/* 往期记录列表 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    gap: 15px;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.3);
}

.history-item--clickable {
    cursor: pointer;
}

.history-item--clickable:active {
    transform: scale(0.99);
}

.history-period {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 100px;
}

.history-result {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-horse {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.history-horse.win {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 140, 0, 0.3));
    border: 1px solid #ffd700;
    color: #ffd700;
}

.history-pool {
    font-size: 12px;
    color: var(--text-secondary);
}

.history-status {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.history-status.settled {
    background: rgba(40, 167, 69, 0.2);
    color: #28a745;
}

/* 我的押注历史 */
.my-bet-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.my-bet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.my-bet-horses {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.my-bet-horse-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.my-bet-horse-tag.win {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.3), rgba(40, 167, 69, 0.1));
    border: 1px solid #28a745;
    color: #28a745;
}

.my-bet-horse-tag.lose {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid #dc3545;
    color: #dc3545;
}

.my-bet-summary {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-secondary);
}

.my-bet-summary .profit {
    color: #28a745;
    font-weight: bold;
}

.my-bet-summary .loss {
    color: #dc3545;
}

/* 空状态 */
.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.history-empty::before {
    content: '📋';
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ========== 往期开奖详情弹窗 ========== */
body.horse-modal-open {
    overflow: hidden;
}

.horse-detail-body {
    padding: 4px 0 16px;
}

.horse-detail-hero {
    text-align: center;
    padding: 16px 12px;
    margin-bottom: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 215, 0, 0.35);
}

.horse-detail-phase {
    margin: 0 0 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.horse-detail-win {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.horse-detail-meta {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.horse-detail-block {
    margin-bottom: 18px;
}

.horse-detail-block h4 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.horse-detail-winners,
.horse-detail-my-bets,
.horse-detail-stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.horse-detail-winners li,
.horse-detail-my-bets li,
.horse-detail-stats li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 13px;
}

.horse-detail-name {
    flex: 1;
    min-width: 80px;
    font-weight: 600;
}

.horse-detail-win-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.horse-detail-amt {
    margin-left: auto;
    font-weight: 700;
    font-size: 13px;
}

.horse-detail-amt.win {
    color: #28a745;
}

.horse-detail-amt.lose {
    color: var(--text-secondary);
}

.horse-detail-my-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 13px;
}

.horse-detail-my-row.is-win {
    border: 1px solid rgba(40, 167, 69, 0.35);
}

.horse-detail-empty {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 12px 0;
    margin: 0;
}

/* ========== 押注成功动画 ========== */
@keyframes betSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.bet-success {
    animation: betSuccess 0.3s ease-out;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 25px;
    min-width: 320px;
    max-width: 90%;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-box {
    transform: translateY(0);
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 15px;
    text-align: center;
}

.modal-content {
    margin-bottom: 20px;
}

.modal-info {
    text-align: center;
    padding: 15px;
}

.modal-info .horse-display {
    font-size: 50px;
    margin-bottom: 10px;
}

.modal-info .horse-name-display {
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 5px;
}

.modal-info .amount-display {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
}

.modal-info .amount-display span {
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn:hover {
    border-color: var(--primary);
}

.modal-btn.primary {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    border: none;
}

.modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .horse-page {
        padding: 10px;
    }
    
    .horse-header {
        flex-wrap: wrap;
        padding: 10px 15px;
    }
    
    .horse-header .header-left {
        width: 100%;
        justify-content: center;
    }
    
    .horse-header .header-center {
        width: 100%;
        padding: 10px 0;
    }
    
    .horse-header .header-right {
        position: absolute;
        top: 10px;
        right: 15px;
    }
    
    .horse-list {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .horse-card {
        padding: 12px;
    }
    
    .horse-icon {
        font-size: 30px;
    }
    
    .bet-amount-input {
        flex-direction: column;
    }
    
    .history-item {
        flex-wrap: wrap;
    }
    
    .history-status {
        margin-left: 0;
        margin-top: 5px;
    }
}

.horse-odds-rules {
    margin: 12px 16px 0;
    padding: 10px 12px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    font-size: 13px;
    color: #ccc;
    line-height: 1.5;
}

.horse-payout {
    font-size: 12px;
    color: #ffd700;
    margin-top: 4px;
}

.horse-payout-profit {
    font-size: 11px;
    color: #7ee787;
    margin-top: 2px;
}

@media (max-width: 480px) {
    .horse-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .horse-card {
        padding: 14px 10px;
        min-height: 120px;
    }

    .horse-icon {
        font-size: 36px;
    }

    .horse-name {
        font-size: 13px;
    }

    .horse-bet-amount .amount-value {
        font-size: 14px;
    }
}
