@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:wght@700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --af-bg: #fff; --af-surface: #fff; --af-surface-2: #f8fafc; --af-border: #e2e8f0;
  --af-text: #0f172a; --af-text-2: #475569; --af-text-3: #64748b;
  --af-green: #10b981; --af-green-dim: rgba(16,185,129,0.12);
  --af-blue: #3b82f6; --af-blue-dim: rgba(59,130,246,0.12);
  --af-gold: #f59e0b; --af-gold-dim: rgba(245,158,11,0.12);
  --af-red: #ef4444; --af-red-dim: rgba(239,68,68,0.12);
  --af-purple: #8b5cf6; --af-purple-dim: rgba(139,92,246,0.12);
  --af-teal: #14b8a6; --af-teal-dim: rgba(20,184,166,0.12);
  --af-rose: #f43f5e; --af-rose-dim: rgba(244,63,94,0.12);
  --af-radius: 12px; --af-shadow: 0 1px 3px rgba(0,0,0,0.06),0 1px 2px rgba(0,0,0,0.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Icon utilities ── */
.af-icon-gold { color: #facc15 !important; }
.af-icon-green { color: #22c55e !important; }
.af-icon-blue { color: #3b82f6 !important; }
.af-icon-red { color: #ef4444 !important; }
.af-icon-amber { color: #f59e0b !important; }
.af-icon-tertiary { color: var(--af-text-3) !important; }
.af-icon-accent { color: var(--af-green) !important; }

.af-form-group--tight { margin-bottom: 0 !important; }
.af-hint-text { font-size: 9px; color: var(--af-text-3); margin: 8px 0 0; line-height: 1.5; }
.af-league-all-label { font-weight: 700; color: var(--af-text); }

.af-page {
  display: flex; gap: 20px; align-items: flex-start; padding: 20px;
  min-height: 100vh; font-family: 'Inter', sans-serif; background: var(--af-bg);
}

.af-mobile-filter-bar,
.af-mobile-bottom-actions,
.af-mobile-filter-backdrop,
.af-mobile-close-filters {
  display: none;
}

.af-mobile-filter-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
}

/* ── Panel ── */
.af-panel {
  width: 280px; flex-shrink: 0; background: var(--af-surface);
  border: 1px solid var(--af-border); border-radius: var(--af-radius);
  position: sticky; top: 20px; max-height: calc(100vh - 40px);
  overflow-y: auto; box-shadow: var(--af-shadow);
}
.af-panel::-webkit-scrollbar { width: 4px; }
.af-panel::-webkit-scrollbar-thumb { background: var(--af-border); border-radius: 2px; }

.af-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--af-border);
  background: linear-gradient(135deg, var(--af-green-dim), transparent);
  position: sticky; top: 0; z-index: 2; background-color: var(--af-surface);
}
.af-panel-title { font-family: 'Playfair Display', serif; font-size: 15px; font-weight: 800; color: var(--af-text); display: flex; align-items: center; gap: 8px; }
.af-panel-title i { color: var(--af-green); font-size: 13px; }

.af-reset-btn { display: flex; align-items: center; gap: 4px; font-size: 9px; font-weight: 700; color: var(--af-text-3); background: transparent; border: 1px solid var(--af-border); border-radius: 20px; padding: 3px 10px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; transition: all 0.15s; font-family: 'Inter', sans-serif; }
.af-reset-btn:hover { border-color: var(--af-red); color: var(--af-red); background: var(--af-red-dim); }
.af-reset-btn i { font-size: 8px; }

/* Saved */
.af-saved-row { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--af-border); }
.af-saved-label { font-size: 9px; font-weight: 700; color: var(--af-text-3); text-transform: uppercase; letter-spacing: 0.05em; flex: 1; font-family: 'DM Mono', monospace; }
.af-save-btn { display: flex; align-items: center; gap: 4px; font-size: 9px; font-weight: 700; color: var(--af-green); background: transparent; border: 1px solid var(--af-green-dim); border-radius: 6px; padding: 4px 8px; cursor: pointer; transition: all 0.15s; font-family: 'Inter', sans-serif; }
.af-save-btn:hover { background: var(--af-green-dim); }
.af-save-btn.is-premium-locked {
  border-color: rgba(245, 158, 11, 0.36);
  color: var(--af-text-2);
}
.af-save-btn.is-premium-locked:hover {
  background: rgba(245, 158, 11, 0.08);
  color: var(--af-text);
}
.af-saved-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px 16px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.af-saved-chips::-webkit-scrollbar { display: none; }
.af-chip { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; max-width: 220px; scroll-snap-align: start; white-space: nowrap; font-size: 9px; font-weight: 600; padding: 3px 8px; border-radius: 20px; background: var(--af-bg); border: 1px solid var(--af-border); color: var(--af-text-2); cursor: default; }
.af-chip i:last-child { cursor: pointer; opacity: 0.5; }
.af-chip i:last-child:hover { opacity: 1; color: var(--af-red); }

.af-page .af-saved-chips {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.af-page .af-saved-chips > .af-chip {
  flex: 0 0 auto !important;
  width: max-content;
  max-width: min(82vw, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
  scroll-snap-align: start;
}

/* Filters scroll */
.af-filters-scroll { }

/* Sections */
.af-section { border-bottom: 1px solid var(--af-border); }
.af-section-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; cursor: pointer; transition: background 0.15s; }
.af-section-header:hover { background: var(--af-surface-2); }
.af-section-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.af-section-icon { width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.af-section-icon.icon-green { background: var(--af-green-dim); color: var(--af-green); }
.af-section-icon.icon-blue { background: var(--af-blue-dim); color: var(--af-blue); }
.af-section-icon.icon-amber { background: var(--af-gold-dim); color: var(--af-gold); }
.af-section-icon.icon-red { background: var(--af-red-dim); color: var(--af-red); }
.af-section-icon.icon-purple { background: var(--af-purple-dim); color: var(--af-purple); }
.af-section-icon.icon-teal { background: var(--af-teal-dim); color: var(--af-teal); }
.af-section-icon.icon-rose { background: var(--af-rose-dim); color: var(--af-rose); }
.af-section-icon.icon-sky { background: var(--af-blue-dim); color: var(--af-blue); }
.af-section-meta { display: flex; flex-direction: column; min-width: 0; }
.af-section-name { font-size: 11px; font-weight: 700; color: var(--af-text); }
.af-section-sub { font-size: 9px; color: var(--af-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-section-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.af-section-badge { font-size: 7px; font-weight: 700; padding: 2px 6px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-family: 'DM Mono', monospace; }
.af-section-badge.badge-free { background: var(--af-green-dim); color: var(--af-green); }
.af-section-badge.badge-premium { background: var(--af-gold-dim); color: var(--af-gold); }
.af-toggle-arrow { font-size: 9px; color: var(--af-text-3); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
.af-section.closed .af-toggle-arrow { transform: rotate(-90deg); }
.af-section.closed .af-section-body { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; pointer-events: none; transform: translateY(-5px); }
.af-section-body { padding: 6px 14px 12px; max-height: 800px; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); opacity: 1; transform: translateY(0); transform-origin: top; }

/* Form groups */
.af-form-group { margin-bottom: 10px; }
.af-label { font-size: 10px; font-weight: 700; color: var(--af-text-2); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; display: block; }
.af-date-group { display: block; }
.af-date-pills { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.af-date-pill {
  min-width: 0; height: 36px; padding: 3px 1px; border: 1px solid var(--af-border);
  border-radius: 999px; background: var(--af-bg); color: var(--af-text-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif; cursor: pointer;
}
.af-date-pill strong { font-size: 9px; line-height: 1; }
.af-date-pill span { margin-top: 2px; font-size: 6px; line-height: 1; color: var(--af-text-3); }
.af-date-pill.active { background: var(--af-green); border-color: var(--af-green); color: #fff; box-shadow: 0 2px 7px rgba(16,185,129,.24); }
.af-date-pill.active span { color: rgba(255,255,255,.88); }
.af-date-pill:not(.active):hover { border-color: var(--af-green); color: var(--af-green); }
.af-date-pill.disabled,
.af-date-pill.disabled:hover {
  opacity: .4; cursor: not-allowed; filter: grayscale(.35);
  border-color: var(--af-border); color: var(--af-text-2);
}

/* Market chips */
.af-market-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.af-market-scroll-hint { font-size: 8px; color: var(--af-text-3); }
.af-market-row { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.af-market-row::-webkit-scrollbar { display: none; }
.af-market-chip { flex: 0 0 auto; font-size: 10px; font-weight: 700; padding: 5px 9px; border-radius: 20px; border: 1px solid var(--af-border); background: var(--af-bg); color: var(--af-text-2); cursor: pointer; transition: all 0.18s ease; white-space: nowrap; font-family: 'Inter', sans-serif; }
.af-market-row > .af-market-chip { min-width: max-content; }
.af-market-chip:hover { border-color: var(--af-green); color: var(--af-green); }
.af-market-chip.active { background: var(--af-green); border-color: var(--af-green); color: #fff; }
.af-market-chip.premium-chip { border-color: var(--af-gold-dim); }
.af-market-chip.premium-chip.active { background: var(--af-gold); border-color: var(--af-gold); }

.af-market-premium-wrap { margin-top: 6px; }
.af-market-premium-header { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--af-gold-dim); border: 1px solid rgba(245,158,11,0.2); border-radius: 6px; cursor: pointer; font-size: 10px; color: var(--af-gold); font-weight: 700; }
.af-market-premium-label { display: flex; align-items: center; gap: 4px; }
.af-market-premium-count { font-size: 8px; color: var(--af-gold); opacity: 0.6; }
.af-market-premium-body { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; }
.af-market-premium-body.open { max-height: 800px; }

/* Premium grid wrap */
.af-prem-grid-wrap { padding: 8px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.af-prem-category { display: flex; flex-direction: column; gap: 5px; }
.af-prem-cat-label {
    font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--af-gold); font-family: 'DM Mono', monospace;
    padding: 0 2px;
    display: flex; align-items: center; gap: 4px;
}
.af-prem-cat-label::before {
    content: ''; display: inline-block; width: 12px; height: 1px;
    background: linear-gradient(90deg, var(--af-gold), transparent);
}
.af-premium-market-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px;
}

/* Premium chevron animation */
.af-prem-chevron { font-size: 9px; color: var(--af-gold); transition: transform 0.25s ease; margin-left: auto; }
.af-market-premium-body.open ~ * .af-prem-chevron,
#af-premium-markets-toggle .af-prem-chevron { }
.af-market-premium-wrap:has(.af-market-premium-body.open) .af-prem-chevron { transform: rotate(180deg); }

/* Premium pill base (gold theme) */
.af-prem-pill {
    background: transparent;
    border: 1px solid rgba(245,158,11,0.25);
    color: var(--af-text-2);
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}
.af-prem-pill::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(251,191,36,0.05));
    opacity: 0; transition: opacity 0.15s;
}
.af-prem-pill:hover { border-color: var(--af-gold); color: var(--af-gold); }
.af-prem-pill:hover::before { opacity: 1; }
.af-prem-pill.active {
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(251,191,36,0.12));
    border-color: var(--af-gold);
    color: var(--af-gold);
    box-shadow: 0 0 0 1px rgba(245,158,11,0.15);
}

/* Premium chip (market buttons) */
.af-market-chip.premium-chip {
    border-color: rgba(245,158,11,0.3);
    color: var(--af-text-2);
    font-size: 9px;
    background: linear-gradient(135deg, rgba(245,158,11,0.04), transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.af-market-chip.premium-chip::before {
    content: "\f521";
    color: var(--af-gold);
    font-family: "Font Awesome 6 Free";
    font-size: 7px;
    font-weight: 900;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(245,158,11,.22));
}
.af-page[data-can-use-premium="true"] .af-market-chip.premium-chip::before { display: none; }
.af-market-chip.premium-chip:hover {
    border-color: var(--af-gold);
    color: var(--af-gold);
    background: rgba(245,158,11,0.08);
}
.af-market-chip.premium-chip.active {
    background: linear-gradient(135deg, var(--af-gold), #f59e0b);
    border-color: var(--af-gold);
    color: #1a1200;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.af-market-chip.premium-chip.active::before { color: #4a2a00; }

/* Gold slider for value radar */
.af-slider.gold::-webkit-slider-thumb { border-color: var(--af-gold); }
#sec-value .af-slider { accent-color: var(--af-gold); }


/* League list */
.af-league-search { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--af-border); border-radius: 6px; background: var(--af-bg); margin-bottom: 6px; }
.af-league-search i { font-size: 10px; color: var(--af-text-3); }
.af-league-search input { flex: 1; border: none; background: transparent; font-size: 10px; outline: none; color: var(--af-text); font-family: 'Inter', sans-serif; }
.af-league-list { max-height: 160px; overflow-y: auto; border: 1px solid var(--af-border); border-radius: 6px; }
.af-league-item { display: flex; align-items: center; gap: 6px; padding: 5px 8px; font-size: 10px; color: var(--af-text-2); cursor: pointer; border-bottom: 1px solid var(--af-border); transition: background 0.1s; }
.af-league-item:last-child { border-bottom: none; }
.af-league-item:hover { background: var(--af-surface-2); }
.af-league-item input { accent-color: var(--af-blue); flex-shrink: 0; }
.af-league-item img { width: 14px; height: 14px; object-fit: contain; border-radius: 2px; flex-shrink: 0; }

/* Streak / Pill grids */
.af-streak-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.af-streak-pill { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 6px; border-radius: 9px; border: 1px solid var(--af-border); font-size: 9px; font-weight: 700; color: var(--af-text-2); cursor: pointer; transition: all 0.18s ease; background: var(--af-bg); font-family: 'Inter', sans-serif; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.3; position: relative; }
.af-streak-pill:hover { border-color: var(--af-green); color: var(--af-green); }
.af-streak-pill.active { background: var(--af-green); border-color: var(--af-green); color: #fff; }
.af-streak-pill i { font-size: 13px; }
.af-streak-pill.premium-streak-pill::after {
    content: "\f521";
    position: absolute;
    top: 6px;
    right: 7px;
    color: var(--af-gold);
    font-family: "Font Awesome 6 Free";
    font-size: 7px;
    font-weight: 900;
    line-height: 1;
    filter: drop-shadow(0 1px 1px rgba(245,158,11,.25));
}
.af-page[data-can-use-premium="true"] .premium-streak-pill::after { display: none; }

/* Confidence */
.af-confidence-grid { display: flex; gap: 5px; flex-wrap: wrap; }
.af-conf-pill { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--af-border); font-size: 10px; font-weight: 700; color: var(--af-text-2); cursor: pointer; transition: all 0.18s ease; background: var(--af-bg); font-family: 'Inter', sans-serif; position: relative; }
.af-conf-pill:hover { border-color: var(--af-gold); color: var(--af-gold); }
.af-conf-pill.active { background: var(--af-gold-dim); border-color: var(--af-gold); color: var(--af-gold); }
.af-conf-pill i { font-size: 9px; }
.af-page[data-can-use-premium="false"] .premium-filter-control::after {
    content: "\f521";
    position: absolute;
    top: 5px;
    right: 6px;
    color: var(--af-gold);
    font-family: "Font Awesome 6 Free";
    font-size: 7px;
    font-weight: 900;
    line-height: 1;
    z-index: 2;
    filter: drop-shadow(0 1px 1px rgba(245,158,11,.25));
}
.af-page[data-can-use-premium="false"] .premium-range-control::after {
    content: "\f521";
    position: absolute;
    top: -20px;
    right: 2px;
    color: var(--af-gold);
    font-family: "Font Awesome 6 Free";
    font-size: 7px;
    font-weight: 900;
    line-height: 1;
    z-index: 2;
    filter: drop-shadow(0 1px 1px rgba(245,158,11,.25));
}
.af-range-wrap.premium-range-control { position: relative; }
.af-page[data-can-use-premium="false"] .premium-range-control { cursor: pointer; }
.af-page[data-can-use-premium="true"] .af-section-badge.badge-premium { display: none; }
.af-page[data-can-use-premium="false"] .probability-range-control { position: relative; }
.af-page[data-can-use-premium="false"] .probability-range-control::after {
    content: "\f521";
    position: absolute;
    top: -1px;
    right: 42px;
    color: var(--af-gold);
    font-family: "Font Awesome 6 Free";
    font-size: 7px;
    font-weight: 900;
}

/* Intensity Score */
.af-intensity-grid { display: flex; gap: 5px; }
.af-intensity-bar {
    flex: 1; height: 36px; border-radius: 8px; border: 1px solid var(--af-border);
    cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
    padding-bottom: 4px; font-size: 8px; font-weight: 800; color: var(--af-text-3);
    text-transform: uppercase; transition: all 0.18s ease; background: var(--af-bg);
    position: relative; overflow: hidden; font-family: 'Inter', sans-serif;
}
.af-intensity-bar::before {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    border-radius: 8px 8px 0 0; transition: height 0.3s ease;
}

.af-intensity-bar[data-level="1"]::before { height: 20%; background: rgba(16,185,129,0.25); }
.af-intensity-bar[data-level="2"]::before { height: 40%; background: rgba(245,158,11,0.25); }
.af-intensity-bar[data-level="3"]::before { height: 60%; background: rgba(239,68,68,0.25); }
.af-intensity-bar[data-level="4"]::before { height: 80%; background: rgba(139,92,246,0.25); }
.af-intensity-bar[data-level="5"]::before { height: 100%; background: rgba(244,63,94,0.25); }

.af-intensity-bar.active[data-level="1"]::before { background: rgba(16,185,129,0.7); }
.af-intensity-bar.active[data-level="2"]::before { background: rgba(245,158,11,0.7); }
.af-intensity-bar.active[data-level="3"]::before { background: rgba(239,68,68,0.7); }
.af-intensity-bar.active[data-level="4"]::before { background: rgba(139,92,246,0.7); }
.af-intensity-bar.active[data-level="5"]::before { background: rgba(244,63,94,0.7); }

.af-intensity-bar.active { border-color: currentColor; }
.af-intensity-label { position: relative; z-index: 1; }

/* Range sliders */
.af-range-wrap { }
.af-range-labels { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 10px; font-weight: 700; color: var(--af-text-2); font-family: 'DM Mono', monospace; }
.af-range-val { display: flex; align-items: center; gap: 3px; }
.af-range-prefix { font-size: 7px; color: var(--af-text-3); font-weight: 600; }
.af-range-sep { font-size: 9px; color: var(--af-text-3); }
.af-slider { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; background: var(--af-border); border-radius: 2px; outline: none; margin: 4px 0; }
.af-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--af-surface); border: 2px solid var(--af-blue); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.af-slider.amber::-webkit-slider-thumb { border-color: var(--af-gold); }

/* Apply button */
.af-apply-wrap { padding: 10px 14px; border-top: 1px solid var(--af-border); background: var(--af-surface); position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.af-apply-btn { width: 100%; padding: 10px; border-radius: 8px; border: none; background: linear-gradient(135deg, var(--af-green), #059669); color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s; font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.04em; box-shadow: 0 4px 12px rgba(16,185,129,0.25); }
.af-apply-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.35); }
.af-apply-btn i { font-size: 12px; }

/* ── Results ── */
.af-results { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.af-results-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 6px; border-bottom: 1px solid var(--af-border); }
.af-results-title { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 800; color: var(--af-text); display: flex; align-items: center; gap: 8px; }
.af-results-title i { color: var(--af-green); font-size: 14px; }
.af-results-count { font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; color: var(--af-green); background: var(--af-green-dim); padding: 3px 10px; border-radius: 12px; }
.af-results-actions { display: flex; align-items: center; gap: 8px; }
.af-sort-select { padding: 5px 10px; border: 1px solid var(--af-border); border-radius: 7px; font-size: 11px; font-weight: 600; background: var(--af-surface); color: var(--af-text-2); outline: none; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.af-sort-select:hover { border-color: #cbd5e1; }
.af-sort-select:focus { border-color: var(--af-blue); box-shadow: 0 0 0 2px var(--af-blue-dim); }
.af-how-to { font-size: 10px; font-weight: 600; color: var(--af-green); text-decoration: none; display: flex; align-items: center; gap: 5px; padding: 6px 12px; border: 1px solid var(--af-green-dim); border-radius: 20px; transition: all 0.2s; }
.af-how-to:hover { background: var(--af-green-dim); }

/* Active pills */
.af-active-pills { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; padding: 4px 0 8px; }
.af-active-pill { display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--af-surface-2); border: 1px solid var(--af-border); color: var(--af-text-2); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.af-active-pill button { background: none; border: none; color: var(--af-text-3); cursor: pointer; padding: 0; font-size: 10px; line-height: 1; transition: color 0.15s ease; }
.af-active-pill button:hover { color: var(--af-red); }

/* Loading */
.af-loading { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; }
.af-shimmer { height: 48px; border-radius: 8px; background: linear-gradient(90deg, var(--af-border) 25%, rgba(255,255,255,0.5) 50%, var(--af-border) 75%); background-size: 600px 100%; animation: af-shim 1.4s infinite linear; }
@keyframes af-shim { 0% { background-position: -600px 0; } 100% { background-position: 600px 0; } }

/* Empty state */
.af-empty { text-align: center; padding: 60px 20px; }
.af-empty-icon { font-size: 36px; color: var(--af-blue); opacity: 0.3; margin-bottom: 12px; }
.af-empty h3 { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--af-text); margin-bottom: 8px; }
.af-empty p { font-size: 12px; color: var(--af-text-3); max-width: 400px; margin: 0 auto; line-height: 1.5; }

/* Match cards */
#af-match-list { display: flex; flex-direction: column; gap: 10px; }

/* League group */
.af-league-group { background: var(--af-surface); border: 1px solid var(--af-border); border-radius: var(--af-radius); overflow: hidden; box-shadow: var(--af-shadow); }
.af-league-header { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--af-bg); border-bottom: 1px solid var(--af-border); font-size: 10px; font-weight: 700; color: var(--af-text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.af-league-flag { width: 16px; height: 16px; object-fit: contain; border-radius: 2px; }
.af-league-name { flex: 1; font-weight: 700; color: var(--af-text); }
.af-league-country { color: var(--af-text-3); font-weight: 500; }
.af-league-count { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--af-text-3); }

/* Match row */
.af-match-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--af-border); text-decoration: none; transition: background 0.12s; cursor: pointer; }
.af-match-row:last-child { border-bottom: none; }
.af-match-row:hover { background: var(--af-surface-2); }
.af-match-time { font-size: 11px; font-weight: 700; color: var(--af-text-2); white-space: nowrap; min-width: 38px; text-align: center; }
.af-match-teams { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.af-team-row { display: flex; align-items: center; gap: 6px; }
.af-team-crest { width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; }
.af-team-name { font-size: 11px; font-weight: 600; color: var(--af-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-match-signal { display: flex; flex-direction: column; gap: 3px; min-width: 90px; text-align: center; }
.af-signal-label { font-size: 9px; font-weight: 600; color: var(--af-text-3); white-space: nowrap; }
.af-signal-bar { height: 4px; border-radius: 2px; background: var(--af-border); overflow: hidden; }
.af-signal-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.af-match-odds { font-size: 13px; font-weight: 800; color: var(--af-text-3); min-width: 36px; text-align: right; }


.af-mcard { background: var(--af-surface); border: 1px solid var(--af-border); border-radius: var(--af-radius); overflow: hidden; box-shadow: var(--af-shadow); }
.af-mcard-league { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--af-bg); border-bottom: 1px solid var(--af-border); font-size: 9px; font-weight: 600; color: var(--af-text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.af-mcard-league img { width: 14px; height: 14px; object-fit: contain; border-radius: 2px; }

.af-mcard-body { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }

.af-mcard-teams { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.af-mcard-team { display: flex; align-items: center; gap: 8px; }
.af-mcard-team img { width: 18px; height: 18px; object-fit: contain; }
.af-mcard-team span { font-size: 11px; font-weight: 600; color: var(--af-text); }
.af-mcard-team small { font-size: 9px; color: var(--af-text-3); font-weight: 400; margin-left: auto; }
.af-mcard-vs { display: flex; align-items: center; gap: 6px; font-size: 9px; color: var(--af-text-3); padding-left: 26px; }

.af-mcard-signals { display: flex; gap: 4px; flex-wrap: wrap; }
.af-mcard-signal { font-size: 8px; font-weight: 700; padding: 3px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em; font-family: 'DM Mono', monospace; }
.af-mcard-signal.signal-high { background: var(--af-green-dim); color: var(--af-green); border: 1px solid rgba(16,185,129,0.2); }
.af-mcard-signal.signal-med { background: var(--af-gold-dim); color: var(--af-gold); border: 1px solid rgba(245,158,11,0.2); }
.af-mcard-signal.signal-low { background: var(--af-red-dim); color: var(--af-red); border: 1px solid rgba(239,68,68,0.2); }

.af-mcard-odds { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.af-mcard-odds-val { font-size: 14px; font-weight: 800; color: var(--af-text); font-family: 'DM Mono', monospace; }
.af-mcard-odds-prob { font-size: 9px; color: var(--af-text-3); font-family: 'DM Mono', monospace; display: flex; align-items: center; gap: 4px; }
.af-mcard-odds-prob-bar { width: 40px; height: 4px; background: var(--af-border); border-radius: 2px; overflow: hidden; }
.af-mcard-odds-prob-fill { height: 100%; border-radius: 2px; }

.af-mcard-bottom { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-top: 1px solid var(--af-border); font-size: 8px; color: var(--af-text-3); }
.af-mcard-bottom i { font-size: 8px; }
.af-mcard-meta { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* Pagination */
.af-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; }
.af-page-btn { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--af-border); background: var(--af-surface); font-size: 10px; font-weight: 700; color: var(--af-text-2); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.12s; font-family: 'Inter', sans-serif; }
.af-page-btn:hover { border-color: var(--af-blue); color: var(--af-blue); }
.af-page-btn:disabled { opacity: 0.3; cursor: default; }
.af-page-btn:disabled:hover { border-color: var(--af-border); color: var(--af-text-3); }
.af-page-info { font-size: 10px; font-weight: 700; color: var(--af-text-3); font-family: 'DM Mono', monospace; }

/* Modal */
.af-modal-overlay { display: none; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.af-modal-overlay.open { display: flex; }
.af-modal-box { background: var(--af-surface); border-radius: 16px; max-width: 560px; width: 90%; padding: 28px; border: 1px solid var(--af-border); box-shadow: 0 24px 60px rgba(0,0,0,0.25); max-height: 85vh; overflow-y: auto; animation: af-modal-in 0.3s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }
@keyframes af-modal-in { 0% { opacity: 0; transform: scale(0.95) translateY(10px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.af-modal-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; position: sticky; top: -28px; background: var(--af-surface); padding: 20px 0 12px; z-index: 2; border-bottom: 1px solid var(--af-border); }
.af-modal-hdr-left { display: flex; align-items: center; gap: 10px; }
.af-modal-hdr-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.af-modal-hdr-icon.green { background: var(--af-green-dim); color: var(--af-green); }
.af-modal-hdr-title { font-size: 15px; font-weight: 800; color: var(--af-text); }
.af-modal-close { background: none; border: none; color: var(--af-text-3); cursor: pointer; font-size: 18px; padding: 4px; }
.af-modal-close:hover { color: var(--af-text); }
.af-modal-body { font-size: 12px; color: var(--af-text-2); line-height: 1.6; }
.af-modal-body p { margin-bottom: 12px; }
.af-modal-subtitle { font-weight: 700; color: var(--af-text); margin: 16px 0 8px; font-size: 13px; border-bottom: 1px solid var(--af-border); padding-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.af-modal-list { padding-left: 18px; margin: 0 0 12px; }
.af-modal-list li { margin-bottom: 6px; }
.af-modal-tip { background: var(--af-green-dim); border-left: 3px solid var(--af-green); padding: 10px 14px; border-radius: 4px; margin-top: 16px; font-size: 11px; }
.af-modal-tip strong { color: var(--af-text); }

/* Premium lock overlay in panel */
.af-lock-overlay { position: absolute; inset: 0; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: rgba(255,255,255,0.85); backdrop-filter: blur(2px); z-index: 2; }
.af-lock-icon { font-size: 18px; color: var(--af-gold); }
.af-lock-text { font-size: 11px; font-weight: 700; color: var(--af-text); }
.af-lock-cta { font-size: 9px; color: var(--af-gold); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .af-page { flex-direction: column; padding: 12px; gap: 12px; }
  .af-panel { width: 100%; position: static; max-height: none; }
  .af-mcard-body { flex-direction: column; align-items: stretch; }
  .af-mcard-odds { flex-direction: row; align-items: center; justify-content: space-between; }
  .af-results-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 640px) {
  .af-page {
    padding: 8px 8px calc(78px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    min-height: auto;
  }

  .af-page *,
  .af-page *::before,
  .af-page *::after {
    min-width: 0;
  }

  .af-results,
  .af-league-group,
  .af-mcard {
    width: 100%;
    max-width: 100%;
    border-radius: 8px;
  }

  .af-mobile-filter-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 10px;
    border: 1px solid var(--af-border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--af-surface) 92%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
  }

  .af-mobile-filter-copy {
    min-width: 0;
  }

  .af-mobile-filter-kicker {
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: var(--af-green);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .af-mobile-filter-summary {
    margin-top: 3px;
    color: var(--af-text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .af-mobile-filter-summary::-webkit-scrollbar {
    display: none;
  }

  .af-mobile-filter-btn,
  .af-mobile-bottom-btn,
  .af-mobile-close-filters {
    border: 1px solid var(--af-border);
    background: var(--af-surface);
    color: var(--af-text);
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    cursor: pointer;
  }

  .af-mobile-filter-btn {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--af-green);
  }

  .af-mobile-filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(3px);
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  .af-page.mobile-filters-open .af-mobile-filter-backdrop {
    display: block;
    opacity: 1;
  }

  .af-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8010;
    width: 100%;
    max-width: 100%;
    height: min(86dvh, 760px);
    max-height: none;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.32);
    transform: translateY(105%);
    visibility: hidden;
    /* hide after slide-down finishes; reveal instantly on open */
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0.28s;
  }

  .af-page.mobile-filters-open .af-panel {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0s;
  }

  .af-panel-header {
    min-height: 56px;
  }

  .af-mobile-close-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    margin-left: auto;
  }

  .af-panel-header .af-reset-btn {
    margin-left: 6px;
  }

  .af-filters-scroll {
    max-height: calc(min(86dvh, 760px) - 132px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .af-mobile-bottom-actions {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--af-border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--af-surface) 94%, transparent);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  }

  .af-mobile-bottom-btn {
    min-height: 44px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
  }

  .af-mobile-bottom-btn.primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--af-green), #059669);
    color: #fff;
    box-shadow: 0 5px 16px rgba(16, 185, 129, 0.26);
  }

  .af-panel-header,
  .af-saved-row {
    padding-left: 12px;
    padding-right: 12px;
  }

  .af-panel-title {
    font-size: 14px;
    line-height: 1.2;
  }

  .af-reset-btn,
  .af-save-btn {
    min-height: 32px;
    padding: 6px 10px;
    white-space: nowrap;
  }

  .af-saved-chips,
  .af-active-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-left: 12px;
    padding-right: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .af-saved-chips::-webkit-scrollbar,
  .af-active-pills::-webkit-scrollbar {
    display: none;
  }

  .af-chip,
  .af-active-pill {
    flex: 0 0 auto;
    max-width: 82vw;
  }

  .af-section-header {
    padding: 11px 12px;
    gap: 8px;
  }

  .af-section-left {
    flex: 1;
  }

  .af-section-name {
    font-size: 12px;
  }

  .af-section-sub {
    max-width: 100%;
  }

  .af-section-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .af-form-group {
    width: 100%;
  }

  .af-date-group,
  .af-streak-grid {
    grid-template-columns: 1fr;
    display: grid;
    width: 100%;
  }

  .af-confidence-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .af-conf-pill {
    justify-content: center;
  }

  .af-date-group {
    gap: 8px;
  }

  .af-date-input,
  .af-sort-select,
  .af-league-search,
  .af-league-item,
  .af-market-chip,
  .af-streak-pill,
  .af-conf-pill {
    min-height: 38px;
  }

  .af-date-input {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    font-size: 12px;
  }

  .af-market-row {
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px 8px;
    scroll-snap-type: x proximity;
  }

  .af-market-chip {
    scroll-snap-align: start;
    padding-left: 12px;
    padding-right: 12px;
  }

  .af-premium-market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .af-market-premium-header {
    min-height: 38px;
  }

  .af-intensity-grid {
    gap: 4px;
  }

  .af-intensity-bar {
    height: 42px;
    font-size: 7px;
  }

  .af-apply-wrap {
    padding: 10px 12px;
    position: sticky;
    bottom: 0;
  }

  .af-apply-btn {
    min-height: 42px;
  }

  .af-results {
    gap: 10px;
  }

  .af-results-header {
    padding: 10px 0 8px;
  }

  .af-results-title {
    width: 100%;
    flex-wrap: wrap;
    font-size: 14px;
  }

  .af-results-count {
    margin-left: auto;
  }

  .af-results-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .af-sort-select {
    width: 100%;
  }

  .af-how-to {
    min-height: 38px;
    justify-content: center;
    white-space: nowrap;
  }

  .af-league-header {
    padding: 9px 10px;
    gap: 6px;
  }

  .af-league-name,
  .af-league-country {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .af-league-count {
    flex-shrink: 0;
  }

  .af-match-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 42px;
    grid-template-areas:
      "time teams odds"
      "time signal odds";
    align-items: center;
    gap: 8px;
    padding: 10px;
  }

  .af-match-time {
    grid-area: time;
    min-width: 0;
    width: 48px;
    text-align: left;
  }

  .af-match-teams {
    grid-area: teams;
    width: 100%;
  }

  .af-team-name {
    display: block;
    max-width: 100%;
  }

  .af-match-signal {
    grid-area: signal;
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .af-signal-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .af-match-odds {
    grid-area: odds;
    min-width: 0;
    width: 42px;
    text-align: right;
    align-self: center;
  }

  .af-mcard-league,
  .af-mcard-body,
  .af-mcard-bottom {
    padding-left: 10px;
    padding-right: 10px;
  }

  .af-mcard-team span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .af-mcard-bottom,
  .af-mcard-meta {
    flex-wrap: wrap;
  }

  .af-mcard-meta {
    margin-left: 0;
  }

  .af-pagination {
    gap: 8px;
    padding: 10px 0;
  }

  .af-page-btn {
    min-height: 38px;
    padding: 8px 10px;
  }

    .af-empty {
        display: flex;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    min-height: 230px;
    padding: 42px 18px;
    text-align: center;
  }

  .af-empty-icon {
    margin: 0;
    flex: 0 0 auto;
  }

  .af-empty h3 {
    width: 100%;
    max-width: 260px;
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
  }

  .af-empty p {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.55;
  }

  .af-modal-overlay {
    align-items: stretch;
    justify-content: center;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px calc(82px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  .af-modal-box {
    width: 100%;
    max-width: none;
    height: calc(100dvh - 102px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: none;
    margin: 0;
    border-radius: 12px;
    padding: 18px 16px calc(40px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .af-modal-hdr {
    top: -18px;
    padding-top: 14px;
    gap: 10px;
  }

  .af-modal-hdr-title {
    font-size: 14px;
    line-height: 1.25;
  }
}

@supports not (height: 100dvh) {
  @media (max-width: 640px) {
    .af-modal-box {
      height: calc(100vh - 102px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
  }
}

@media (max-width: 380px) {
  .af-page {
    padding: 6px 6px calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .af-panel-title,
  .af-results-title {
    font-size: 13px;
  }

  .af-section-icon {
    width: 22px;
    height: 22px;
  }

  .af-section-badge {
    display: none;
  }

  .af-match-row {
    grid-template-columns: 44px minmax(0, 1fr) 38px;
    gap: 7px;
  }

  .af-match-time {
    width: 44px;
    font-size: 10px;
  }

  .af-team-name,
  .af-match-odds {
    font-size: 11px;
  }

  .af-results-actions {
    grid-template-columns: 1fr;
  }
}
