.trends-page .page-hero { padding-top: 24px; padding-bottom: 0; }
.trends-page .page-hero h1 { font-size: clamp(38px,4vw,50px); margin: 7px 0 8px; line-height: 1.1; }
.trends-page .page-hero p { font-size: 16px; margin-bottom: 0; }
.trends-workspace { padding-top: 15px; }
.trends-inventory { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; max-width: 920px; margin-bottom: 18px; }
.trends-inventory > div { border-left: 2px solid #29445f; padding: 2px 16px; }
.trends-inventory strong { display: block; color: #78caff; font-family: var(--display); font-size: 30px; line-height: 1; }
.trends-inventory span { color: var(--muted); font-size: 12px; }
.trends-controls { display: grid; grid-template-columns: 120px minmax(0,1.6fr) minmax(0,1fr) max-content; align-items: end; gap: 16px; padding: 13px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
.trends-control-group + .trends-control-group { border-left: 1px solid #35516d; padding-left: 18px; }
.trends-control-history > .control-label { display: block; }
.trends-history-button.btn,.trends-history-button { min-height: 40px; padding: 8px 12px; background: #08131f; color: var(--red-bright); border: 1px solid var(--red-bright); border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.trends-history-button.btn:hover,.trends-history-button.btn:focus { background: #25141c; color: #ff7070; border-color: #ff7070; }
.trends-history-button:disabled { opacity: .4; cursor: not-allowed; }
.trends-controls .shiny-input-container { margin: 0; width: auto !important; }
.trends-controls .control-label { font-size: 13px; margin-bottom: 7px; }
.trends-controls select { min-height: 40px; background: #08131f; color: var(--text); border: 1px solid #38516c; border-radius: 8px; }
.trends-controls .shiny-options-group { display: flex; flex-wrap: wrap; gap: 7px; }
.trends-controls .radio-inline { position: relative; padding: 9px 11px; margin: 0; border-radius: 8px; background: #08131f; color: var(--muted); cursor: pointer; border: 1px solid var(--line); font-size: 13px; }
.trends-controls .radio-inline input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.trends-controls .radio-inline:has(input:checked) { background: var(--blue-bright); color: #06101b; border-color: var(--blue-bright); font-weight: 800; }
.trends-controls .radio-inline:has(input:focus-visible) { outline: 2px solid white; outline-offset: 2px; }
.trends-provenance,.trends-sample-note { color: #90a8c3; font-size: 12px; line-height: 1.5; }
.trends-provenance { margin: 10px 0 20px; }
.trends-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 18px; }
.trends-summary h2 { margin: 0; font-family: var(--display); font-size: 29px; }
.trends-summary p { margin: 0; color: var(--muted); font-size: 13px; }
.trends-sample-note { margin: 3px 0 12px; }
.trends-games { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
.trend-game-row,.trend-vault-row { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; min-width: 0; }
.trend-game-row::before,.trend-vault-row::before { content: ''; position: absolute; top: -1px; left: 20px; width: 50px; height: 2px; border-radius: 3px; background: #2b8ed677; }
.trend-game-row.mixed::before { background: #ff4e4e77; }
.trend-game-summary { display: grid; grid-template-columns: 150px 85px minmax(0,1fr) minmax(0,1fr) 76px; align-items: center; gap: 22px; padding: 17px 20px; cursor: pointer; list-style: none; }
.trend-game-summary::-webkit-details-marker { display: none; }
.trend-game-summary:hover { background: #14233766; border-radius: 13px; }
.trend-game-summary:focus-visible { outline: 2px solid #79caff; outline-offset: 3px; border-radius: 13px; }
.trend-matchup { min-width: 0; }
.trend-matchup > strong { display: block; font-family: var(--display); font-size: 25px; line-height: 1.15; color: #eff5fc; }
.trend-matchup > span,.trend-matchup > small { display: block; font-size: 12px; color: #9ab5d1; margin-top: 3px; }
.trend-matchup > small { font-size: 11px; color: #8299b3; }
.trend-label { justify-self: start; font-size: 13px; font-weight: 800; border-radius: 7px; padding: 5px 10px; background: #182b3f; white-space: nowrap; }
.trend-label.side { color: #83d0ff; border: 1px solid #2c5776; }
.trend-label.mixed { color: #ffaaa3; border: 1px solid #754044; }
.trend-label.neutral { color: #9db0c5; }
.trend-compact-side { border-left: 1px solid #2c4159; padding-left: 20px; min-width: 0; }
.trend-compact-side-title { display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px; }
.trend-compact-side-title b { font-size: 13px; }
.trend-compact-side-title span { font-size: 11px; color: #94abc4; }
.trend-compact-history { display: flex; gap: 12px; align-items: baseline; }
.trend-compact-history strong { color: #79caff; font-family: var(--display); font-size: 26px; line-height: 1.15; }
.trend-compact-history span { color: #d7e4f2; font-size: 13px; font-weight: 600; }
.trend-compact-side > small { display: block; color: #91a8c3; font-size: 11px; line-height: 1.5; }
.trend-compact-none { display: block; color: #758ba3; font-size: 22px; line-height: 1.6; }
.trend-row-toggle { color: var(--red-bright); font-size: 13px; font-weight: 700; white-space: nowrap; justify-self: end; }
.trend-chevron { display: inline-block; font-size: 18px; padding-left: 2px; }
.trend-game-row[open] .trend-chevron { transform: rotate(180deg); }
.trend-game-details { padding: 0 20px 20px; border-top: 1px solid #2b4058; }
.trend-balance { display: flex; align-items: center; gap: 12px; margin: 10px 0; max-width: 600px; font-size: 12px; color: #93abc5; }
.trend-balance strong { color: #dce9f7; font-size: 13px; }
.trend-balance-track { position: relative; height: 6px; background: #1c3147; border-radius: 10px; flex: 1; min-width: 35px; }
.trend-balance-track::after { content: ''; position: absolute; height: 12px; width: 1px; background: #738ba5; left: 50%; top: -3px; }
.trend-balance-track i { position: absolute; width: 8px; height: 12px; top: -3px; border-radius: 2px; background: #79caff; transform: translateX(-50%); z-index: 1; }
.trend-model-comparison { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: #adc2d9; margin: 12px 0; }
.trend-context-note { color: #91a8c0; font-size: 12px; margin: 12px 0; }
.trend-evidence-section { margin-top: 20px; }
.trend-evidence-section h3 { font-size: 15px; color: #b7cfe8; margin: 0 0 8px; }
.trend-evidence-head,.trend-evidence-row { display: grid; grid-template-columns: 52px minmax(0,1fr) 125px 112px 118px; align-items: start; gap: 18px; }
.trend-evidence-head { padding: 7px 0; color: #8fa7c3; font-size: 11px; }
.trend-evidence-row { border-top: 1px solid #24384e; padding: 12px 0; font-size: 12px; color: #c1d0e2; }
.trend-evidence-side b { font-size: 13px; }
.trend-description p { line-height: 1.55; margin: 0; }
.trend-history strong { color: #79caff; font-family: var(--display); font-size: 22px; line-height: 1; margin-right: 8px; }
.trend-history span { font-weight: 700; white-space: nowrap; }
.trend-history small { display: block; font-size: 10px; color: #91a6c0; margin-top: 3px; }
.trend-context .trend-history strong { color: #a4b5c8; }
.trend-vault-row { display: grid; grid-template-columns: 150px 75px minmax(0,1fr) 75px; gap: 28px; align-items: center; padding: 17px 20px; }
.vault-count b,.vault-count strong,.vault-count small { display: block; }
.vault-count b { font-size: 13px; }
.vault-count strong { color: #79caff; font-family: var(--display); font-size: 30px; line-height: 1.05; }
.vault-count:last-child { text-align: right; }
.vault-count:last-child strong { color: #ff929c; }
.vault-count small { color: #8fa7c2; font-size: 10px; }
.vault-chart { min-width: 0; }
.vault-volume-bar { display: flex; overflow: hidden; height: 12px; border-radius: 10px; background: #1a3048; }
.vault-volume-bar > div:first-child { background: #2b9cda; }
.vault-volume-bar > div:last-child { background: #f05b72; }
.vault-share-labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; font-size: 12px; }
.vault-share-labels strong:first-child { color: #79caff; }
.vault-share-labels strong:last-child { color: #ff929c; }
.vault-method-note { color: #91a8c3; font-size: 10px; margin: 7px 0 0; }
.trends-empty { padding: 20px; border: 1px solid var(--line); border-radius: 13px; color: #a1b7d0; }
.trends-history-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 20px 0; }
.trends-history-heading h2 { margin: 0; font-family: var(--display); font-size: 34px; }
.trends-history-heading p { margin: 4px 0 0; color: #91a8c3; font-size: 13px; }
.trends-output-wrap { min-height: 100px; }
.trends-loading { display: none; align-items: center; gap: 10px; padding: 22px 0; color: #a9c5e5; font-size: 15px; }
.trends-output-wrap:has(> .shiny-html-output:empty) > .trends-loading,
.trends-output-wrap:has(> .recalculating) > .trends-loading { display: flex; }
.trends-loading-spinner { width: 19px; height: 19px; border: 2px solid #35516d; border-top-color: #79caff; border-radius: 50%; animation: trends-loading-spin .8s linear infinite; }
@keyframes trends-loading-spin { to { transform: rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .trends-loading-spinner { animation: none; } }
.trends-history-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 18px; margin: 16px 0; }
.trends-history-stats > div { padding: 15px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.trends-history-stats strong { display: block; color: #79caff; font-family: var(--display); font-size: 34px; line-height: 1.1; }
.trends-history-stats span { display: block; color: #96adc6; font-size: 12px; margin-top: 5px; }
.trends-history-table { width: 100%; margin: 20px 0; border-collapse: collapse; color: #d8e5f4; font-size: 14px; background: var(--panel); }
.trends-history-table th,.trends-history-table td { padding: 12px 15px; border-bottom: 1px solid #2b4058; text-align: right; }
.trends-history-table th:first-child { text-align: left; }
.trends-history-table thead th { color: #93b8dd; font-size: 12px; }
.trends-history-table .trends-results-total { font-weight: 800; border-top: 2px solid #52708e; background: #172b40; }
.trends-result-games { margin: 26px 0 0; border-top: 1px solid #35516d; padding-top: 17px; }
.trends-result-games > summary { color: var(--red-bright); font-size: 15px; font-weight: 700; cursor: pointer; }
.trends-result-game { display: grid; grid-template-columns: 170px 140px minmax(0,1fr) 110px; gap: 20px; align-items: center; padding: 15px 0; border-bottom: 1px solid #2b4058; font-size: 13px; }
.trends-result-game strong,.trends-result-game b { display: block; }
.trends-result-game small { display: block; font-size: 11px; color: #8fa7c3; margin-top: 3px; }
.trends-result-score { color: #b6cbe2; }
.trends-result-outcome { text-align: right; }
.trends-result-pill { display: inline-block !important; border: 1px solid #445c75; border-radius: 6px; padding: 4px 9px; font-size: 12px; }
.trends-result-pill.win { color: #76d6a2; border-color: #3b795a; }
.trends-result-pill.loss { color: #ff9292; border-color: #8a4c53; }
.trends-result-pill.push,.trends-result-pill.pending { color: #9cafc5; }
@media(max-width:1100px) {
  .trends-controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .trends-control-market { border-left: 0 !important; padding-left: 0 !important; }
  .trend-game-summary { grid-template-columns: 125px 75px minmax(0,1fr) minmax(0,1fr) 65px; gap: 14px; }
  .trend-compact-side { padding-left: 14px; }
  .trend-evidence-head,.trend-evidence-row { grid-template-columns: 45px minmax(0,1fr) 110px 95px 105px; gap: 12px; }
}
@media(max-width:750px) {
  .trends-controls { grid-template-columns: 1fr; gap: 13px; }
  .trends-control-group + .trends-control-group { border-left: 0; padding-left: 0; border-top: 1px solid #35516d; padding-top: 12px; }
  .trend-game-summary { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px 18px; padding: 15px; }
  .trend-matchup { grid-column: 1; }
  .trend-game-summary > .trend-label { grid-column: 2; justify-self: end; }
  .trend-compact-side { grid-row: 2; border-left: 0; padding-left: 0; }
  .trend-compact-side + .trend-compact-side { border-left: 1px solid #2c4159; padding-left: 18px; }
  .trend-row-toggle { grid-column: 2; }
  .trend-game-details { padding: 0 15px 15px; }
  .trend-evidence-head { display: none; }
  .trend-evidence-row { grid-template-columns: 42px minmax(0,1fr); gap: 8px 12px; }
  .trend-evidence-row .trend-history,.trend-evidence-row .trend-recent,.trend-evidence-row .trend-through { grid-column: 2; }
  .trend-recent::before { content: 'Recent sample: '; color: #91a6c0; }
  .trend-through::before { content: 'History through '; color: #91a6c0; }
  .trend-vault-row { grid-template-columns: minmax(0,1fr) 60px 60px; gap: 15px; padding: 15px; }
  .trend-vault-row .vault-chart { grid-column: 1 / -1; grid-row: 2; }
  .trend-vault-row .vault-count:last-child { grid-column: 3; grid-row: 1; }
  .trends-history-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .trends-result-game { grid-template-columns: minmax(0,1fr) 110px; gap: 8px 15px; }
  .trends-result-score { grid-row: 2; }
  .trends-result-outcome { grid-column: 2; grid-row: 2; }
}
@media(max-width:600px) {
  .trends-history-table thead { display: none; }
  .trends-history-table tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 10px 0; border-bottom: 1px solid #35516d; }
  .trends-history-table tbody th { grid-column: 1 / -1; }
  .trends-history-table th,.trends-history-table td { display: block; border: 0; padding: 5px 10px; font-size: 12px; text-align: left; }
  .trends-history-table td::before { content: attr(data-label) ': '; color: #8fa7c3; font-weight: 400; }
}
@media(max-width:480px) {
  .trends-inventory { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .trends-controls .radio-inline { padding: 8px; font-size: 12px; }
  .trend-compact-history { gap: 7px; }
  .trend-compact-history strong { font-size: 23px; }
  .trend-compact-history span { font-size: 12px; }
  .trend-compact-side > small { font-size: 10px; }
}

/* Use the established result pills on current trend cards, too. */
.trend-card-result { margin-top: 7px; }
.trend-card-result .best-bet-result { display: inline-block; }
