:root {
    --bg: #f3f4f6;
    --bg-soft: #fafafa;
    --card: #ffffff;
    --card-2: #f8fafc;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --text: #111827;
    --text-2: #374151;
    --muted: #6b7280;
    --muted-2: #9ca3af;
    --brand: #f59e0b;
    --brand-dark: #d97706;
    --brand-soft: #fef3c7;
    --brand-soft-2: #fde68a;
    --success: #10b981;
    --danger: #ef4444;
    --blue: #3b82f6;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --shadow-sm: 0 2px 8px rgba(17, 24, 39, .06);
    --shadow-md: 0 6px 20px rgba(17, 24, 39, .08);
    --radius: 10px;
    --c1: #60a5fa;
    --c2: #34d399;
    --c3: #f59e0b;
    --c4: #f472b6;
    --c5: #a78bfa;
    --c6: #fb7185;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, rgba(255, 164, 122, 0.28), transparent 34%), linear-gradient(180deg, #fff7f0 0%, var(--bg) 32%, #f2ede7 100%);
    -webkit-font-smoothing: antialiased;
    padding-bottom: env(safe-area-inset-bottom);
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    min-height: 100vh;
}

.wrap {
    max-width: 730px;
    margin: 0 auto;
    padding: 12px 12px 18px;
}

.hero {
    background: linear-gradient(135deg, var(--brand) 0%, #fbbf24 100%);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    position: relative;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.16), transparent 42%), linear-gradient(225deg, rgba(255,255,255,.08), transparent 36%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    padding: 16px;
}

.topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.brand-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.brand-badge {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.26);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    flex: 0 0 auto;
    letter-spacing: .04em;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
    color: #fff;
    font-weight: 800;
    letter-spacing: .02em;
}

.sub {
    margin-top: 8px;
    color: rgba(255,255,255,.92);
    font-size: 13px;
    line-height: 1.55;
    max-width: 760px;
}

.ghost {
    flex: 0 0 auto;
    min-height: 42px;
    border-radius: 8px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.32);
    background: rgba(255,255,255,.16);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .18s ease, transform .18s ease;
}

.ghost:hover {
    background: rgba(255,255,255,.24);
    transform: translateY(-1px);
}

.ghost svg {
    width: 16px;
    height: 16px;
}

.form-lite {
    margin-top: 14px;
}

.form {
    display: block;
}

.form .row {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 10px;
}

.field {
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    color: rgba(255,255,255,.92);
    font-weight: 600;
    padding: 0 2px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

select,
.picker-trigger {
    width: 100%;
    height: 44px;
    margin-top: 0;
    padding: 0 12px;
    border-radius: 8px;
    border: 0;
    outline: none;
    background: #fff;
    color: #111827;
    font-size: 14px;
    box-shadow: none;
    transition: box-shadow .18s ease, transform .18s ease;
}

select:focus,
.picker-trigger:focus {
    box-shadow: 0 0 0 3px rgba(255,255,255,.22);
}

select {
    appearance: none;
    -webkit-appearance: none;
}

select option {
    color: #111827;
    background: #fff;
}

.picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
}

.picker-arrow {
    opacity: .65;
    margin-left: 8px;
    flex: 0 0 auto;
}

.league-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
}

.league-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(17,24,39,.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.league-modal-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(94vw, 730px);
    max-height: 86vh;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 18px 48px rgba(17,24,39,.22);
    display: flex;
    flex-direction: column;
}

.league-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--brand);
    color: #fff;
}

.league-modal-title {
    font-size: 16px;
    font-weight: 800;
}

.league-modal-close {
    border: 1px solid rgba(255,255,255,.28);
    background: rgba(255,255,255,.14);
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
}

.league-modal-search-wrap {
    padding: 12px 16px 0;
    background: #fff;
}

.league-modal-search {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--text);
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
    font-size: 14px;
}

.league-modal-search:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(245,158,11,.16);
}

.league-modal-body {
    display: grid;
    grid-template-columns: 1fr 36px;
    gap: 8px;
    min-height: 0;
    padding: 12px 10px 14px 16px;
    flex: 1;
    background: #fff;
}

.league-group-list {
    overflow-y: auto;
    padding-right: 6px;
    min-height: 0;
}

.league-group {
    margin-bottom: 14px;
}

.league-group-title {
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 12px;
    color: var(--brand-dark);
    background: #fffaf0;
    padding: 7px 4px;
    font-weight: 800;
    border-bottom: 1px solid var(--line);
}

.league-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-top: 8px;
}

.league-item {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
    min-width: 0;
    transition: border-color .18s ease, transform .16s ease, background .18s ease;
}

.league-item:hover {
    transform: translateY(-1px);
    border-color: #fbbf24;
    background: #fffaf0;
}

.league-item.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px rgba(245,158,11,.12);
}

.league-item-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.league-item-sub {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}

.league-index-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    overflow-y: auto;
    padding-top: 4px;
    user-select: none;
}

.league-index-item {
    width: 28px;
    height: 22px;
    border-radius: 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    cursor: pointer;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 700;
}

.league-index-item:hover {
    background: var(--brand-soft);
    border-color: #fbbf24;
    color: var(--brand-dark);
}

.league-empty {
    text-align: center;
    color: var(--muted);
    padding: 24px 12px;
}

.results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.cardHead {
    padding: 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fff 0, #fffbeb 100%);
    border-bottom: 1px solid var(--line);
}

.leftInfo {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 240px;
    flex: 1;
}

.cardHead .dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: var(--brand);
    box-shadow: none;
    margin-top: 5px;
    flex: 0 0 auto;
}

.meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.line1 {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.league {
    font-size: 15px;
    color: var(--text);
    font-weight: 800;
    white-space: nowrap;
}

.lottery {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--brand-dark);
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    border: 1px solid #fcd34d;
    font-weight: 700;
}

.time {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.teams {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.5;
}

.teams .home,
.teams .away {
    font-weight: 700;
}

.teams .mid {
    font-family: var(--mono);
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--brand);
    border: 0;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.rightTags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chip {
    font-size: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text-2);
    white-space: nowrap;
    font-weight: 600;
}

.chip.mono {
    font-family: var(--mono);
}

.detailChip {
    text-decoration: none;
    position: relative;
    padding: 8px 12px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    border-color: var(--brand);
    box-shadow: none;
}

.detailChip:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    transform: translateY(-1px);
}

.detailChip::after {
    content: "→";
    margin-left: 6px;
    font-size: 12px;
    opacity: .92;
}

.probStack {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card-2);
}

.probStack details {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.probStack summary {
    cursor: pointer;
    list-style: none;
    padding: 12px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    user-select: none;
    font-weight: 800;
    font-size: 13px;
    color: var(--text);
    background: #fff;
}

.probStack summary::-webkit-details-marker {
    display: none;
}

.summaryRight {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-family: var(--mono);
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.panel {
    padding: 12px 13px 13px;
    border-top: 1px solid var(--line);
    background: #fcfcfd;
}

.stackRow {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
}

.rowLabel {
    font-size: 12.5px;
    color: var(--text-2);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    font-weight: 700;
}

.rowLabel .pct {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--brand-dark);
    padding: 3px 8px;
    border: 1px solid #fcd34d;
    border-radius: 999px;
    background: var(--brand-soft);
    font-weight: 700;
}

.barWrap {
    width: 100%;
    height: 16px;
    border-radius: 0;
    background: #e5e7eb;
    overflow: hidden;
    position: relative;
}

.barOuter {
    transform-origin: left center;
    height: 100%;
    width: 100%;
}

.bar {
    height: 100%;
    width: 100%;
    display: flex;
}

.seg {
    height: 100%;
    min-width: 0;
    position: relative;
    transition: opacity .15s ease;
}

.seg:hover {
    opacity: .9;
}

.seg::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 1px;
    background: rgba(255,255,255,.45);
}

.seg:last-child::after {
    display: none;
}

.legend {
    margin-top: 9px;
    display: flex;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    flex-wrap: wrap;
}

.lg {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--line);
    padding: 4px 8px;
    border-radius: 999px;
}

.sw {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex: 0 0 auto;
}

.lg .t {
    font-family: var(--mono);
    color: var(--text-2);
}

.lg .v {
    font-family: var(--mono);
    color: var(--brand-dark);
    font-weight: 700;
}

.empty {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 22px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: #fff;
}

.site-footer {
    margin-top: 22px;
    padding: 18px 12px calc(22px + env(safe-area-inset-bottom));
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.footer-inner {
    max-width: 980px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.8;
}

.footer-links a {
    color: var(--text-2);
    text-decoration: none;
    padding: 2px 4px;
}

.footer-links a:hover {
    color: var(--brand-dark);
}

.footer-links .sep {
    opacity: .35;
}

.footer-meta {
    margin-top: 10px;
    line-height: 1.6;
}

.footer-meta .slogan {
    margin-top: 4px;
    font-size: 11px;
    opacity: .8;
}

#backToTop {
    position: fixed;
    right: 16px;
    bottom: 20px;
    width: 46px;
    height: 46px;
    line-height: 46px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    background: var(--brand);
    border: none;
    color: #fff;
    box-shadow: 0 10px 24px rgba(245,158,11,.28);
    font-size: 20px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease, background .2s ease;
}

#backToTop.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#backToTop:hover {
    background: var(--brand-dark);
}

@media (max-width: 768px) {
    .wrap {
        padding: 10px 10px 16px;
    }

    .hero-inner {
        padding: 14px;
    }

    .topline {
        flex-direction: column;
        align-items: stretch;
    }

    .brand-wrap {
        gap: 10px;
    }

    .brand-badge {
        width: 42px;
        height: 42px;
        font-size: 14px;
    }

    .brand-text h1 {
        font-size: 20px;
    }

    .sub {
        font-size: 12.5px;
    }

    .ghost {
        align-self: flex-start;
    }

    .form .row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .label {
        margin-bottom: 5px;
    }

    select,
    .picker-trigger {
        height: 42px;
        font-size: 14px;
    }

    .cardHead {
        padding: 12px;
    }

    .rightTags {
        width: 100%;
        justify-content: flex-start;
    }

    .stackRow {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .league-modal-panel {
        width: 96vw;
        max-height: 90vh;
        border-radius: 8px;
    }

    .league-items {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .brand-text h1 {
        font-size: 18px;
    }

    .legend {
        gap: 6px;
    }

    .lg {
        padding: 4px 7px;
    }

    .summaryRight {
        display: none;
    }

    .teams {
        font-size: 13px;
    }
}
