* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif; background: #f0f2f5; color: #1a2332; padding-bottom: 0; -webkit-font-smoothing: antialiased; }
.header { background: #152f52; color: #fff; padding: 14px 16px 12px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(21,47,82,0.3); }
.header-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.header-left { flex-shrink: 0; }
.header-title { font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.header-title span { color: #ffd700; }
.header-sub { font-size: 12px; opacity: 0.8; margin-top: 4px; }
.header-search { display: flex; align-items: center; background: rgba(255,255,255,0.15); border-radius: 20px; padding: 4px 10px; flex: 1; max-width: 220px; }
.header-search input { background: transparent; border: none; color: #fff; font-size: 13px; padding: 6px 0; outline: none; width: 100%; }
.header-search input::placeholder { color: rgba(255,255,255,0.6); }
.header-search .clear-btn { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 16px; cursor: pointer; padding: 0 2px; display: none; }
.header-search .clear-btn.visible { display: block; }
.header-search .search-count { font-size: 11px; color: rgba(255,255,255,0.7); margin-left: 6px; white-space: nowrap; }
.play-tabs { background: #fff; padding: 8px 12px; margin: 10px 12px 0; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); display: flex; gap: 4px; }
.play-tab { flex: 1; text-align: center; padding: 6px 0; font-size: 14px; font-weight: 500; border: none; border-radius: 8px; background: transparent; color: #666; cursor: pointer; transition: all 0.2s; }
.play-tab.active { background: #152f52; color: #fff; box-shadow: 0 2px 6px rgba(21,47,82,0.2); }
.play-tab:active { transform: scale(0.96); }
.recommend-btn-wrap { margin: 10px 12px 0; }
.recommend-btn-wrap .btn { display: block; width: 100%; padding: 10px 0; text-align: center; background: #152f52; color: #fff; border-radius: 10px; font-size: 16px; font-weight: 600; text-decoration: none; border: none; cursor: pointer; }
.recommend-btn-wrap .btn:active { opacity: 0.8; }
.recommend-btn-wrap .btn .badge { background: #e74c3c; color: #fff; border-radius: 50%; padding: 0 8px; font-size: 12px; margin-left: 6px; }
.stats { background: #fff; padding: 10px 16px; margin: 10px 12px 0; border-radius: 10px; display: flex; justify-content: space-between; font-size: 13px; color: #666; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.stats strong { color: #152f52; font-size: 15px; }
.recommend-page { padding: 10px 12px; }
.recommend-page .back-link { display: inline-block; margin-bottom: 12px; color: #152f52; text-decoration: none; font-size: 14px; }
.recommend-page .back-link::before { content: '‹ '; font-size: 18px; }
.recommend-page .page-title { font-size: 20px; font-weight: 700; color: #152f52; margin-bottom: 12px; }
.recommend-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); padding: 14px 16px; margin-bottom: 10px; }
.recommend-card .name { font-size: 17px; font-weight: 600; color: #152f52; }
.recommend-card .time { font-size: 12px; color: #999; margin-top: 2px; }
.recommend-card .items { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.recommend-card .item-tag { background: #eef1f4; border-radius: 16px; padding: 4px 12px; font-size: 13px; color: #333; }
.recommend-card .item-tag .num { font-weight: 600; color: #152f52; }
.recommend-card .item-tag .label { color: #e74c3c; }
.empty-tip { text-align: center; color: #bbb; padding: 40px 0; font-size: 15px; }
.date-group { margin: 10px 12px; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); overflow: hidden; }
.date-header { padding: 12px 16px; background: #f8f9fa; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; border-bottom: 1px solid #eee; }
.date-header:hover { background: #e9ecef; }
.date-header .arrow { transition: transform 0.2s; font-size: 14px; color: #888; }
.date-header .arrow.collapsed { transform: rotate(-90deg); }
.date-header .date-title { font-size: 16px; font-weight: 600; color: #152f52; }
.date-header .match-count { font-size: 13px; color: #888; margin-left: 8px; }
.date-body { padding: 6px 0; display: block; }
.date-body.collapsed { display: none; }
.match-list { padding: 0; }
.match-card { background: #fff; border-radius: 0; margin: 0; box-shadow: none; border-bottom: 1px solid #f0f2f5; }
.match-card:last-child { border-bottom: none; }
.match-header { padding: 12px 14px 10px; cursor: pointer; }
.match-header .top-row { display: flex; justify-content: space-between; align-items: flex-start; }
.match-info { display: flex; flex-wrap: wrap; align-items: center; flex: 1; gap: 2px 6px; }
.match-info .league-name { width: 100%; font-size: 16px; color: #888; margin-bottom: 2px; }
.match-num { background: #152f52; color: #fff; font-size: 11px; font-weight: 600; padding: 1px 10px; border-radius: 12px; letter-spacing: 0.5px; flex-shrink: 0; }
.match-teams { font-size: 18px; font-weight: 600; color: #1a2332; flex: 1; text-align: center; }
.match-teams .vs { color: #999; font-weight: 400; margin: 0 4px; }
.match-right { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; margin-left: 8px; }
.match-meta { display: flex; flex-direction: column; align-items: flex-end; }
.match-date { font-size: 13px; color: #aaa; }
.match-time-display { font-size: 15px; color: #333; font-weight: 500; }
.match-score { font-size: 20px; font-weight: 700; }
.match-score.finished { color: #27ae60; }
.match-score.live { color: #e74c3c; }
.match-status-text { font-size: 14px; font-weight: 600; color: #e74c3c; }
.match-status-text.finished { color: #27ae60; }
.match-status-text.halftime { color: #f39c12; }
.finished-tag { color: #e74c3c; font-size: 14px; font-weight: 700; margin-right: 8px; }
.status-tag { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 14px; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; background: #ccc; color: #fff; }
.status-未 { background: #3498db; }
.status-完 { background: #27ae60; }
.status-进行 { background: #e74c3c; }
.status-中场 { background: #f39c12; color: #fff; }
.match-body { padding: 12px 14px 14px; background: #fafbfc; display: block; }
.match-body.collapsed { display: none; }
.match-arrow { transition: transform 0.2s; font-size: 14px; color: #888; margin-left: 8px; flex-shrink: 0; cursor: pointer; }
.match-arrow.collapsed { transform: rotate(-90deg); }
.handicap-red { background: #e74c3c !important; color: #fff !important; }
.handicap-hidden { display: none !important; }
.odds-hda { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.odds-hda .handicap { background: #152f52; color: #fff; font-size: 12px; font-weight: 600; padding: 2px 12px; border-radius: 14px; flex-shrink: 0; }
.odds-hda .hda-item { flex: 1; min-width: 52px; text-align: center; background: #fff; border-radius: 8px; padding: 6px 2px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); cursor: pointer; transition: all 0.15s; border: 2px solid transparent; }
.odds-hda .hda-item.selected { border-color: #152f52; background: #e8edf5; }
.odds-hda .hda-item .label { font-size: 11px; color: #888; }
.odds-hda .hda-item .value { font-size: 16px; font-weight: 700; color: #e74c3c; }
.odds-hda .hda-item .value.draw { color: #f39c12; }
.section-title { font-size: 13px; font-weight: 600; color: #152f52; margin: 8px 0 6px; padding-bottom: 2px; border-bottom: 2px solid #eef1f4; }
.section-title:first-child { margin-top: 0; }
.grid-4 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin-bottom: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 8px; }
.grid-item { background: #fff; border-radius: 4px; padding: 3px 1px; text-align: center; font-size: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); cursor: pointer; transition: all 0.15s; border: 2px solid transparent; }
.grid-item.selected { border-color: #152f52; background: #e8edf5; }
.grid-item .label { color: #555; font-size: 16px; }
.grid-item .odds { color: #e74c3c; font-weight: 700; font-size: 12px; }
.odds-row { display: flex; flex-wrap: wrap; gap: 6px; }
.odds-tag { background: #fff; padding: 4px 14px; border-radius: 16px; font-size: 13px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); cursor: pointer; transition: all 0.15s; border: 2px solid transparent; }
.odds-tag.selected { border-color: #152f52; background: #e8edf5; }
.odds-tag .val { color: #e74c3c; font-weight: 700; margin-left: 4px; }
.empty-tip { color: #bbb; font-size: 13px; text-align: center; padding: 10px 0; }
.loading-tip { text-align: center; padding: 20px 0; color: #aaa; font-size: 14px; }
.loading-tip::after { content: ''; display: inline-block; width: 16px; height: 16px; margin-left: 8px; border: 2px solid #ddd; border-top-color: #152f52; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.no-data { text-align: center; padding: 50px 0; color: #bbb; font-size: 15px; }
.no-data .icon { font-size: 48px; display: block; margin-bottom: 12px; }

.calculator {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
    padding: 12px 16px 16px;
    z-index: 200;
    display: none;
    border-top: 2px solid #152f52;
    flex-direction: column;
    height: 18vh;
    max-height: 27vh;
    overflow: hidden;
    transition: height 0.3s ease, max-height 0.3s ease;
}
.calculator.show {
    display: flex;
}
.calculator.expanded {
    height: auto;
    max-height: 80vh;
    overflow-y: auto;
}

.calc-row {
    flex-shrink: 0;
}
#selectedListContainer {
    flex: 0 0 auto;
    display: none;
    flex-direction: column;
    margin-top: 6px;
}
#selectedListContainer.has-items {
    display: flex;
}
.selected-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: #f0f2f5;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #333;
}
.selected-list-wrapper {
    flex: 0 0 auto;
    overflow: visible;
    display: none;
    padding: 4px 0;
}
.selected-list-wrapper.open {
    display: block;
}
.selected-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 13px;
}

@keyframes slideUp { 0% { transform: translateY(100%); } 100% { transform: translateY(0); } }
.calc-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.calc-row:first-child { margin-top: 0; }
.calc-label { font-size: 14px; font-weight: 500; color: #333; flex-shrink: 0; }
.calc-odds-display { background: #eef1f4; padding: 4px 12px; border-radius: 16px; font-size: 14px; font-weight: 700; color: #152f52; flex: 1; min-width: 60px; cursor: pointer; position: relative; user-select: none; }
.calc-odds-display .dropdown-arrow { margin-left: 6px; font-size: 12px; }
.mode-dropdown { display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 220px; z-index: 300; padding: 6px; display: none; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.mode-dropdown.show { display: grid; }
.mode-dropdown .mode-item { padding: 6px 4px; font-size: 12px; text-align: center; cursor: pointer; transition: background 0.15s; border-radius: 6px; background: #f8f9fa; border: 1px solid transparent; white-space: nowrap; }
.mode-dropdown .mode-item:hover { background: #eef1f4; }
.mode-dropdown .mode-item.active { background: #152f52; color: #fff; border-color: #152f52; }
.selected-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid #eee; gap: 8px; }
.selected-item .team { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.selected-item .results { color: #e74c3c; font-weight: 600; flex-shrink: 0; margin-right: 4px; font-size: 20px; }
.selected-item .del { color: #e74c3c; cursor: pointer; font-size: 16px; font-weight: 700; padding: 0 4px; flex-shrink: 0; margin-left: 2px; }
.selected-item .del:active { opacity: 0.5; }
.selected-item .del::before { content: '删除'; }
.calc-input-group { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 100px; }
.calc-input-group input { border: 1px solid #ddd; border-radius: 8px; padding: 6px 10px; font-size: 16px; width: 80px; outline: none; }
.calc-input-group input:focus { border-color: #152f52; }
.calc-input-group .bet-amount-display { font-size: 16px; font-weight: 600; color: #152f52; white-space: nowrap; }
.calc-result { font-size: 18px; font-weight: 700; color: #e74c3c; min-width: 80px; text-align: center; white-space: nowrap; }
.btn { background: #eef1f4; border: none; border-radius: 20px; padding: 4px 14px; font-size: 13px; cursor: pointer; color: #666; flex-shrink: 0; transition: background 0.15s; }
.btn:active { background: #ddd; }
.btn-primary { background: #152f52; color: #fff; }
.btn-primary:active { background: #0e1f36; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:active { background: #1e8449; }
.hint { font-size: 12px; color: #999; margin-top: 4px; text-align: center; }
.footer { text-align: center; padding: 16px 0 6px; font-size: 11px; color: #ccc; }
.match-card.hidden-by-search { display: none; }
#qrOverlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9999; justify-content: center; align-items: center; flex-direction: column; }
#qrOverlay.show { display: flex; }
.qr-box { background: #fff; padding: 30px 40px; border-radius: 16px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,0.3); max-width: 90%; position: relative; }
.qr-box .close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 24px; cursor: pointer; color: #999; }
.qr-box .close-btn:hover { color: #333; }
.qr-box img { width: 180px; height: 180px; display: block; margin: 0 auto 10px; }
.qr-box p { font-size: 16px; font-weight: 500; color: #333; margin: 6px 0; }
.qr-box .sub { font-size: 13px; color: #999; }
.qr-box .hint { font-size: 12px; color: #aaa; margin-top: 10px; }
.match-card.playtype-hidden { display: none; }
#confirmOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9998;
    justify-content: center;
    align-items: center;
}
#confirmOverlay.show {
    display: flex;
}
.confirm-box {
    background: #fff;
    padding: 30px 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.confirm-box p {
    font-size: 18px;
    font-weight: 500;
    margin: 0 0 20px 0;
    color: #1a2332;
}
.confirm-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}
.confirm-buttons .btn {
    padding: 8px 30px;
    font-size: 16px;
    border-radius: 30px;
    min-width: 80px;
    border: none;
    cursor: pointer;
}
.confirm-buttons .btn-primary {
    background: #152f52;
    color: #fff;
}
.confirm-buttons .btn-default {
    background: #eef1f4;
    color: #666;
}
.confirm-buttons .btn-default:active {
    background: #ddd;
}
.jq-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.jq-grid .odds-tag {
    background: #fff;
    border-radius: 4px;
    padding: 6px 2px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.jq-grid .odds-tag.selected {
    border-color: #152f52;
    background: #e8edf5;
}
.jq-grid .odds-tag .val {
    color: #e74c3c;
    font-weight: 700;
    margin-left: 0;
    font-size: 16px;
}
.jq-grid .odds-tag .label-text {
    font-size: 14px;
    color: #555;
}
.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: #f0f2f5;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    margin-top: 4px;
    font-size: 14px;
    color: #333;
}
.toggle-text {
    font-size: 13px;
    color: #888;
    font-weight: normal;
}

#unlockOverlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
#unlockOverlay.show {
    display: flex;
}
.unlock-box {
    background: #fff;
    border-radius: 24px;
    padding: 30px 35px 25px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.unlock-content {
    text-align: center;
}
.unlock-title {
    font-size: 22px;
    font-weight: 700;
    color: #152f52;
    margin-bottom: 10px;
}
.unlock-desc {
    font-size: 16px;
    color: #555;
    margin-bottom: 25px;
    line-height: 1.5;
}
.unlock-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}
.unlock-buttons .btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
}
.unlock-buttons .btn-ad {
    background: #27ae60;
    color: #fff;
}
.unlock-buttons .btn-ad:active {
    background: #1e8449;
}
.unlock-buttons .btn-pay {
    background: #f39c12;
    color: #fff;
}
.unlock-buttons .btn-pay:active {
    background: #d68910;
}
.close-unlock {
    position: absolute;
    top: 12px;
    right: 18px;
    background: none;
    border: none;
    font-size: 26px;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}
.close-unlock:hover {
    color: #333;
}

#adCountdown {
    background: #f0f2f5;
    padding: 12px 0;
    border-radius: 30px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
    color: #152f52;
    font-size: 18px;
}
#countdownSeconds {
    color: #e74c3c;
    font-size: 24px;
    padding: 0 4px;
}

#adDisplay {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #1a2332;
}
#adDisplay img {
    width: 100%;
    display: block;
    height: auto;
    border-radius: 12px;
}
.ad-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.ad-overlay .icon { font-size: 48px; }
.ad-overlay .text { font-size: 20px; margin-top: 8px; }
.progress-bar {
    width: 80%;
    height: 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-bar .progress-fill {
    height: 100%;
    background: #f39c12;
    width: 0%;
    transition: width 0.2s linear;
}
/* ===== 小屏手机适配（宽度 < 480px）适度缩放 ===== */
@media screen and (max-width: 600px) {
    .calculator {
        height: auto !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        padding: 12px 14px 16px !important;
        min-height: 140px;
    }
    .calc-row {
        gap: 8px !important;
        margin-top: 6px !important;
        flex-wrap: wrap !important;
    }
    .calc-label {
        font-size: 15px !important;
        font-weight: 500;
    }
    .calc-odds-display {
        font-size: 14px !important;
        padding: 6px 12px !important;
        min-width: 70px !important;
        flex: 0 1 auto !important;
    }
    .calc-input-group input {
        width: 70px !important;
        font-size: 16px !important;
        padding: 6px 10px !important;
    }
    /* ===== 关键：让保存和清空按钮一样大 ===== */
    .calc-row .btn,
    .calc-row .btn-success {
        font-size: 14px !important;
        padding: 6px 14px !important;
        min-width: 60px !important;
        flex: 0 1 auto !important;
        line-height: 1.4;
    }
    .calc-result {
        font-size: 18px !important;
        min-width: 80px !important;
    }
    .bet-amount-display {
        font-size: 15px !important;
    }
    .selected-header {
        font-size: 14px !important;
        padding: 6px 10px !important;
    }
    .selected-list {
        font-size: 14px !important;
        padding: 6px 10px !important;
    }
    .selected-item {
        font-size: 14px !important;
        padding: 6px 0 !important;
    }
    .selected-item .results {
        font-size: 20px !important;
    }
    .selected-item .del::before {
        content: '✕' !important;
        font-size: 18px !important;
    }
    .selected-item .del {
        font-size: 0 !important;
    }
    .mode-dropdown {
        min-width: 200px !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }
    .mode-dropdown .mode-item {
        font-size: 13px !important;
        padding: 8px 4px !important;
    }
}