:root {
    --prediction-yes: #1c9b70;
    --prediction-yes-soft: #edf8f4;
    --prediction-no: #db5656;
    --prediction-no-soft: #fff2f2;
}

/* Use real links for authentication so navigation still works when JavaScript is
 * delayed or unavailable in iOS Safari and embedded WebViews.  The 44px target
 * follows Apple's minimum comfortable touch size. */
.rg-product-prediction .event-auth a {
    position: relative;
    z-index: 2;
    min-height: 44px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(49, 89, 173, .16);
}

[hidden] { display: none !important; }
.prediction-brandbar-inner { grid-template-columns: 310px minmax(320px, 720px) auto; }
.prediction-create { color: var(--rg-primary); }
.prediction-shell { width: min(var(--rg-shell-max), calc(100% - 32px)); max-width: var(--rg-shell-max); margin: 22px auto 48px; }
.prediction-intro { min-height: 86px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-left: 4px solid var(--rg-primary); }
.prediction-intro-copy { min-width: 0; display: flex; align-items: center; gap: 14px; }
.prediction-intro-copy div { min-width: 0; }
.prediction-intro-copy strong { color: var(--rg-text); font-size: 17px; }
.prediction-intro-copy p { margin: 5px 0 0; color: var(--rg-muted); font-size: 13px; }
.prediction-live-dot { width: 9px; height: 9px; flex: 0 0 9px; background: var(--prediction-yes); border-radius: 50%; box-shadow: 0 0 0 5px rgba(28,155,112,.11); }
.prediction-intro-stats { display: flex; align-items: center; }
.prediction-intro-stats span { min-width: 104px; padding: 0 20px; display: flex; flex-direction: column; color: var(--rg-muted); border-left: 1px solid var(--rg-border); font-size: 10px; text-transform: uppercase; }
.prediction-intro-stats strong { color: var(--rg-text); font-size: 19px; font-variant-numeric: tabular-nums; }

.prediction-results { margin-top: 18px; overflow: hidden; }
.prediction-toolbar { min-height: 58px; padding-right: 16px; padding-left: 16px; }
.prediction-toolbar-meta { display: flex; align-items: center; gap: 10px; color: var(--rg-muted); font-size: 12px; white-space: nowrap; }
.prediction-evidence-mark { padding: 5px 8px; color: var(--rg-primary); background: var(--rg-primary-soft); border-radius: 5px; font-weight: 700; }
.prediction-grid { padding: 16px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.prediction-card { position: relative; min-height: 348px; padding: 16px; display: flex; flex-direction: column; overflow: hidden; background: var(--rg-surface); border: 1px solid var(--rg-border); border-radius: var(--rg-radius); box-shadow: var(--rg-shadow); cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.prediction-card:hover, .prediction-card:focus-visible { border-color: var(--rg-primary-border, #b9ccef); box-shadow: 0 14px 34px rgba(29,53,93,.085); transform: translateY(-2px); outline: 0; }
.prediction-card.is-featured { padding-top: 46px; border: 2px solid var(--rg-primary); }
.prediction-card-ribbon { position: absolute; top: 0; right: 0; left: 0; height: 30px; padding: 0 14px; display: flex; align-items: center; gap: 7px; color: #fff; background: var(--rg-primary); font-size: 10px; font-weight: 750; }
.prediction-card-ribbon::before { width: 7px; height: 7px; background: #78e0b9; border-radius: 50%; content: ""; }
.prediction-card-head { display: flex; align-items: center; min-width: 0; }
.prediction-company-badge { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; color: #315594; background: #edf3ff; border: 1px solid #8fb4ff; border-radius: 4px; font-size: 10px; font-weight: 800; }
.prediction-company { min-width: 0; margin-left: 10px; display: flex; flex-direction: column; }
.prediction-company strong, .prediction-company small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prediction-company strong { color: var(--rg-text); font-size: 13px; }
.prediction-company small { margin-top: 4px; color: var(--rg-muted); font-size: 9px; }
.prediction-category { margin-left: auto; padding: 4px 7px; color: #596981; background: #f7f9fc; border: 1px solid var(--rg-border); border-radius: 4px; font-size: 10px; }
.prediction-card h2 { min-height: 70px; margin: 14px 0 11px; color: var(--rg-text); font-size: 16px; line-height: 1.48; }
.prediction-probability { padding: 10px 11px; display: flex; align-items: center; gap: 12px; background: #f7f9fc; border: 1px solid #edf1f6; border-radius: 8px; }
.prediction-ring { --value: 50; --ring-color: var(--prediction-yes); width: 62px; height: 62px; flex: 0 0 62px; display: grid; place-items: center; background: conic-gradient(var(--ring-color) calc(var(--value) * 3.6deg), #e6ebf2 0); border-radius: 50%; }
.prediction-ring span { width: 52px; height: 52px; display: grid; place-items: center; color: var(--rg-text); background: #fff; border-radius: 50%; font-size: 16px; font-weight: 800; }
.prediction-probability-copy { display: flex; flex-direction: column; gap: 5px; color: var(--rg-muted); font-size: 10px; }
.prediction-probability-copy strong { color: var(--prediction-yes); font-size: 12px; }
.prediction-probability-copy strong.is-down { color: var(--prediction-no); }
.prediction-vote-row { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prediction-vote-row button { height: 39px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border-radius: 7px; font-size: 12px; font-weight: 700; }
.prediction-vote-yes { color: #167b5b; background: var(--prediction-yes-soft); border: 1px solid #cbeade; }
.prediction-vote-no { color: #b74747; background: var(--prediction-no-soft); border: 1px solid #f1d4d4; }
.prediction-evidence-row { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.prediction-evidence-row span { padding: 6px; border-radius: 5px; font-size: 9px; text-align: center; }
.prediction-evidence-row span:first-child { color: #187756; background: #f1faf6; }
.prediction-evidence-row span:last-child { color: #b84747; background: #fff6f6; }
.prediction-card footer { margin-top: auto; padding-top: 12px; display: grid; grid-template-columns: 1fr auto auto; gap: 9px; color: var(--rg-muted); border-top: 1px solid var(--rg-border); font-size: 9px; }
.prediction-card footer span { white-space: nowrap; }
.prediction-empty { min-height: 360px; padding: 70px 24px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; color: var(--rg-muted); }
.prediction-empty strong { color: var(--rg-text); font-size: 20px; }

.prediction-performance { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.prediction-metric-card { min-height: 230px; padding: 22px; }
.prediction-eyebrow { color: var(--rg-muted); font-size: 10px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.prediction-metrics { margin-top: 20px; display: grid; grid-template-columns: repeat(3,1fr); }
.prediction-metrics span { display: flex; flex-direction: column; color: var(--rg-muted); font-size: 10px; }
.prediction-metrics strong { color: var(--rg-text); font-size: 25px; }
.prediction-calibration { height: 70px; margin-top: 20px; padding: 8px 12px 0; display: flex; align-items: flex-end; gap: 7px; background: #f7f9fc; border-radius: 7px; }
.prediction-calibration i { flex: 1; background: var(--rg-primary); border-radius: 3px 3px 1px 1px; opacity: .78; }
.prediction-leaderboard { margin: 12px 0 0; padding: 0; list-style: none; }
.prediction-leaderboard li { min-height: 39px; padding: 0 9px; display: grid; grid-template-columns: 35px 1fr auto 58px; align-items: center; gap: 8px; border-bottom: 1px solid var(--rg-border); font-size: 11px; }
.prediction-leaderboard li.is-self { color: var(--rg-primary); background: var(--rg-primary-soft); }
.prediction-leaderboard b, .prediction-leaderboard em { color: var(--rg-muted); font-style: normal; font-weight: 500; }
.prediction-leaderboard strong { color: var(--prediction-yes); text-align: right; }

.prediction-modal-backdrop { position: fixed; z-index: 1000; inset: 0; padding: 22px; display: grid; place-items: center; background: rgba(20,37,66,.58); backdrop-filter: blur(5px); }
.prediction-detail { position: relative; width: min(1280px,100%); height: min(900px,calc(100vh - 44px)); overflow: hidden; background: #fff; border: 1px solid var(--rg-border); border-radius: 12px; box-shadow: 0 30px 100px rgba(20,37,66,.25); }
.prediction-modal-close { position: absolute; z-index: 4; top: 14px; right: 15px; width: 34px; height: 34px; display: grid; place-items: center; color: #626f82; background: #fff; border: 1px solid var(--rg-border); border-radius: 8px; font-size: 21px; }
.prediction-detail-main { height: 100%; margin-right: 350px; padding: 30px 34px 60px; overflow-y: auto; }
.prediction-detail-kicker { display: flex; align-items: center; gap: 8px; color: var(--rg-muted); font-size: 11px; }
.prediction-detail-main > h1 { max-width: 820px; margin: 18px 0; color: var(--rg-text); font-size: 28px; line-height: 1.35; }
.prediction-detail-status { padding-bottom: 20px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--rg-border); }
.prediction-detail-status-copy { display: flex; flex-direction: column; gap: 4px; color: var(--rg-muted); font-size: 10px; }
.prediction-detail-status-copy strong { color: var(--rg-text); font-size: 13px; }
.prediction-detail-actions { margin-left: auto; display: flex; gap: 7px; }
.prediction-secondary, .prediction-detail-actions button { min-height: 36px; padding: 7px 11px; color: #526178; background: #fff; border: 1px solid var(--rg-border); border-radius: 7px; font-weight: 650; }
.prediction-resolution { margin-top: 22px; padding: 16px; background: #f7faff; border: 1px solid #cbd9f2; border-radius: 9px; }
.prediction-resolution header, .prediction-resolution footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.prediction-resolution p { margin: 11px 0; color: #35465f; font-size: 12px; line-height: 1.75; }
.prediction-resolution footer { padding-top: 10px; color: var(--rg-muted); border-top: 1px solid var(--rg-border); font-size: 9px; }
.prediction-resolution footer a { color: var(--rg-primary); }
.prediction-section { margin-top: 30px; }
.prediction-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.prediction-section-heading h2 { margin: 4px 0 0; color: var(--rg-text); font-size: 18px; }
.prediction-evidence-columns { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prediction-argument { overflow: hidden; border: 1px solid var(--rg-border); border-radius: 9px; }
.prediction-argument h3 { margin: 0; padding: 12px 14px; display: flex; justify-content: space-between; font-size: 12px; }
.prediction-argument.is-yes h3 { color: var(--prediction-yes); background: var(--prediction-yes-soft); }
.prediction-argument.is-no h3 { color: var(--prediction-no); background: var(--prediction-no-soft); }
.prediction-evidence-item { padding: 13px; border-top: 1px solid var(--rg-border); }
.prediction-evidence-item strong { font-size: 11px; }
.prediction-evidence-item p { margin: 6px 0 9px; color: #617087; font-size: 10px; line-height: 1.6; }
.prediction-evidence-item a { color: var(--rg-primary); font-size: 9px; }
.prediction-source-grid { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prediction-source-card { min-height: 145px; padding: 14px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--rg-border); border-radius: 9px; }
.prediction-source-card:hover { border-color: var(--rg-primary-border, #b9ccef); box-shadow: var(--rg-shadow); }
.prediction-source-card .rg-type-badge { width: auto; min-height: 0; padding: 4px 8px; display: inline-flex; align-self: flex-start; border-radius: 4px; font-size: 10px; }
.prediction-source-card strong { margin-top: 9px; font-size: 11px; line-height: 1.5; }
.prediction-source-card p { margin: 7px 0; color: var(--rg-muted); font-size: 9px; line-height: 1.6; }
.prediction-source-card small { margin-top: auto; color: var(--rg-primary); }
.prediction-comment-form { margin-top: 14px; padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 9px; border: 1px solid var(--rg-border); border-radius: 9px; }
.prediction-comment-form textarea { min-height: 52px; padding: 9px; resize: vertical; border: 0; outline: 0; }
.prediction-comment { padding: 16px 2px; border-bottom: 1px solid var(--rg-border); }
.prediction-comment header { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.prediction-comment header time { margin-left: auto; color: var(--rg-muted); font-size: 9px; }
.prediction-comment p { margin: 8px 0; color: #4e5e74; font-size: 11px; line-height: 1.7; }
.prediction-comment footer { color: var(--rg-muted); font-size: 9px; }
.prediction-forecast-panel { position: absolute; inset: 0 0 0 auto; width: 350px; padding: 32px 24px; overflow-y: auto; background: #f7f9fc; border-left: 1px solid var(--rg-border); }
.prediction-forecast-panel h2 { margin: 7px 0 16px; font-size: 19px; }
.prediction-side-toggle { padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; background: #eef2f7; border: 1px solid var(--rg-border); border-radius: 9px; }
.prediction-side-toggle button { height: 38px; color: var(--rg-muted); background: transparent; border: 0; border-radius: 7px; font-weight: 700; }
.prediction-side-toggle button.active { background: #fff; box-shadow: 0 2px 8px rgba(20,37,66,.07); }
.prediction-side-toggle button[data-side="yes"].active { color: var(--prediction-yes); }
.prediction-side-toggle button[data-side="no"].active { color: var(--prediction-no); }
.prediction-confidence { margin: 23px 0 12px; display: flex; align-items: baseline; justify-content: space-between; }
.prediction-confidence strong { color: var(--rg-text); font-size: 38px; }
.prediction-confidence span { color: var(--rg-muted); font-size: 10px; }
.prediction-slider { width: 100%; accent-color: var(--prediction-yes); }
.prediction-reason { margin-top: 20px; display: flex; flex-direction: column; gap: 7px; color: #596981; font-size: 10px; font-weight: 700; }
.prediction-reason textarea { min-height: 76px; padding: 10px; resize: vertical; background: #fff; border: 1px solid var(--rg-border); border-radius: 7px; font-weight: 400; }
.prediction-primary { min-height: 40px; padding: 9px 15px; color: #fff; background: var(--rg-primary); border: 1px solid var(--rg-primary); border-radius: 8px; font-weight: 700; }
.prediction-primary:hover { background: var(--rg-primary-dark); }
.prediction-submit { width: 100%; margin-top: 14px; }
.prediction-noncash { color: var(--rg-muted); font-size: 9px; line-height: 1.55; text-align: center; }

.prediction-create-modal { position: relative; width: min(760px,100%); max-height: calc(100vh - 44px); padding: 30px 34px; overflow-y: auto; background: #fff; border: 1px solid var(--rg-border); border-radius: 12px; box-shadow: 0 30px 100px rgba(20,37,66,.25); }
.prediction-create-modal h1 { margin: 7px 0; color: var(--rg-text); font-size: 23px; }
.prediction-create-modal > p { margin: 0 0 20px; color: var(--rg-muted); font-size: 11px; }
.prediction-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prediction-field { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; color: #526178; font-size: 10px; font-weight: 700; }
.prediction-field input, .prediction-field textarea, .prediction-field select { width: 100%; padding: 10px 11px; color: var(--rg-text); background: #fff; border: 1px solid var(--rg-border); border-radius: 7px; outline: 0; font-weight: 400; }
.prediction-field textarea { min-height: 75px; resize: vertical; }
.prediction-field-full { width: 100%; }
.prediction-rule-checks { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.prediction-rule-checks span { padding: 5px 8px; color: var(--prediction-yes); background: var(--prediction-yes-soft); border-radius: 5px; font-size: 9px; font-weight: 700; }
.prediction-create-footer { margin-top: 20px; padding-top: 17px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--rg-border); }
.prediction-create-footer small { max-width: 410px; color: var(--rg-muted); font-size: 9px; line-height: 1.6; }
.prediction-create-footer div { display: flex; gap: 8px; }
.prediction-toast { position: fixed; z-index: 1200; right: 24px; bottom: 24px; padding: 12px 16px; color: #fff; background: var(--rg-text); border-radius: 8px; box-shadow: var(--rg-shadow); font-size: 11px; font-weight: 650; }

@media (max-width: 1240px) {
    .prediction-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 960px) {
    .prediction-brandbar-inner { grid-template-columns: 250px minmax(0,1fr) auto; gap: 20px; }
    .prediction-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .prediction-intro { align-items: flex-start; flex-direction: column; }
    .prediction-detail-main { margin-right: 300px; padding: 26px 24px 50px; }
    .prediction-forecast-panel { width: 300px; padding: 28px 18px; }
    .prediction-evidence-columns, .prediction-source-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .prediction-brandbar-inner { grid-template-columns: 1fr; gap: 12px; padding: 16px 0; }
    .prediction-brandbar .event-brand { display: none; }
    .prediction-brandbar .event-search { width: 100%; }
    .prediction-create { width: 100%; }
    .prediction-shell { width: calc(100% - 24px); margin-top: 12px; }
    .prediction-intro-stats { width: 100%; }
    .prediction-intro-stats span { min-width: 0; flex: 1; padding: 0 10px; }
    .prediction-intro-stats span:first-child { padding-left: 0; border-left: 0; }
    .prediction-toolbar { align-items: flex-start; flex-direction: column; padding: 10px; }
    .prediction-categories { width: 100%; overflow-x: auto; }
    .prediction-grid { grid-template-columns: 1fr; padding: 10px; }
    .prediction-performance { grid-template-columns: 1fr; }
    .prediction-modal-backdrop { padding: 0; }
    .prediction-detail { width: 100%; height: 100%; border-radius: 0; }
    .prediction-detail-main { height: auto; min-height: 100%; margin: 0; padding: 24px 18px 520px; }
    .prediction-detail-main > h1 { font-size: 22px; }
    .prediction-forecast-panel { top: auto; bottom: 0; width: 100%; max-height: 500px; border-top: 1px solid var(--rg-border); border-left: 0; box-shadow: 0 -12px 30px rgba(20,37,66,.1); }
    .prediction-create-modal { width: 100%; min-height: 100vh; max-height: 100vh; padding: 25px 18px; border-radius: 0; }
    .prediction-form-grid { grid-template-columns: 1fr; }
    .prediction-create-footer { align-items: stretch; flex-direction: column; }
    .prediction-create-footer div { justify-content: flex-end; }
}
