/* Soccer 411 design-system contract v0.19.52.
 * New mode-sensitive components must use --s411-ui-* tokens.
 * Effective appearance is resolved by the existing System/Light/Dark controller
 * before first paint. This stylesheet loads after legacy component CSS.
 */
:root {
  --s411-ui-canvas: #f7f8fa;
  --s411-ui-surface: #ffffff;
  --s411-ui-surface-raised: #f6f8f9;
  --s411-ui-surface-hover: #eef2f5;
  --s411-ui-field: #f6f8f9;
  --s411-ui-text: #17243b;
  --s411-ui-muted: #58667c;
  --s411-ui-subtle: #68758a;
  --s411-ui-line: #dfe5eb;
  --s411-ui-brand: #bf1729;
  --s411-ui-focus: #ef0107;
  --s411-ui-warning: #ad2e34;
  --s411-ui-shadow: 0 20px 60px rgba(9,18,28,.16);
  --s411-ui-overlay: rgba(12,18,26,.48);
}
html[data-s411-effective-theme="dark"] {
  --s411-ui-canvas: #10141c;
  --s411-ui-surface: #1a202c;
  --s411-ui-surface-raised: #222c3b;
  --s411-ui-surface-hover: #303d50;
  --s411-ui-field: #202b3a;
  --s411-ui-text: #f3f6fc;
  --s411-ui-muted: #c3cedd;
  --s411-ui-subtle: #b7c4d6;
  --s411-ui-line: #3b475b;
  --s411-ui-brand: #ff656b;
  --s411-ui-focus: #ff777c;
  --s411-ui-warning: #ff969c;
  --s411-ui-shadow: 0 24px 64px rgba(0,0,0,.40);
  --s411-ui-overlay: rgba(4,8,15,.70);
}
/* Reusable building blocks. All new components should use these classes/tokens;
   do not add hard-coded white panels or dark text to component styles. */
.s411-ui-surface,.s411-ui-card,.s411-ui-dialog { background:var(--s411-ui-surface);color:var(--s411-ui-text);border-color:var(--s411-ui-line);color-scheme:light }
html[data-s411-effective-theme="dark"] :is(.s411-ui-surface,.s411-ui-card,.s411-ui-dialog){color-scheme:dark}
.s411-ui-card {border:1px solid var(--s411-ui-line);border-radius:14px}
.s411-ui-muted {color:var(--s411-ui-muted)}
.s411-ui-field {background:var(--s411-ui-field);color:var(--s411-ui-text);border:1px solid var(--s411-ui-line);border-radius:10px}
.s411-ui-field::placeholder {color:var(--s411-ui-muted);opacity:1}
.s411-ui-action {background:var(--s411-ui-surface-raised);color:var(--s411-ui-text);border:1px solid var(--s411-ui-line)}
.s411-ui-action:hover {background:var(--s411-ui-surface-hover)}
.s411-ui-action:focus-visible,.s411-ui-field:focus-visible {outline:2px solid var(--s411-ui-focus);outline-offset:2px}
/* Comment dialog (same markup for post, article and match conversation).
   Override the fixed #fff from app.css only in dark mode, preserving light UI. */
html[data-s411-effective-theme="dark"] body .dm-engagement-drawer-panel {
  background:var(--s411-ui-surface)!important;
  color:var(--s411-ui-text)!important;
  border-color:var(--s411-ui-line)!important;
  box-shadow:var(--s411-ui-shadow)!important;
  color-scheme:dark;
}
html[data-s411-effective-theme="dark"] body .dm-engagement-drawer-backdrop {background:var(--s411-ui-overlay)!important}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-drawer-head,.dm-engagement-comments,.dm-engagement-comment-form,
  .dm-engagement-sheet-handle,.dm-engagement-match-context
) {
  background:var(--s411-ui-surface)!important;
  background-image:none!important;
  color:var(--s411-ui-text)!important;
  border-color:var(--s411-ui-line)!important;
}
html[data-s411-effective-theme="dark"] body .dm-engagement-drawer-head>div>span {color:var(--s411-ui-brand)!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-drawer-head h2,
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-comments-empty strong,.dm-engagement-comment-meta strong,
  .dm-engagement-comment p,.dm-engagement-reply-context strong,
  .dm-engagement-match-now>strong,.dm-engagement-comment-form>p
) {color:var(--s411-ui-text)!important}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-loading,.dm-engagement-comments-empty,
  .dm-engagement-comments-empty>span,.dm-engagement-comment-meta span,
  .dm-engagement-match-now>small,.dm-engagement-comments-empty.is-match>span:last-child,
  .dm-engagement-comment-actions small,.dm-engagement-comment-row-actions button,
  .dm-comment-edit-status,.dm-comment-edited,.dm-engagement-reply-context
) {color:var(--s411-ui-muted)!important}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-comment,.dm-engagement-comment.is-reply,.dm-engagement-comment-form,
  .dm-engagement-drawer-head,.dm-engagement-match-context
) {border-color:var(--s411-ui-line)!important}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-drawer-head>button,.dm-engagement-empty-icon,
  .dm-engagement-reply-context,.dm-engagement-comment-author textarea,
  .dm-comment-edit-form textarea,.dm-comment-edit-form button,
  .dm-engagement-prompt,.dm-engagement-match-now>span
) {
  background:var(--s411-ui-surface-raised)!important;
  border-color:var(--s411-ui-line)!important;
  color:var(--s411-ui-text)!important;
}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-drawer-head>button:hover,.dm-engagement-prompt:hover,
  .dm-comment-edit-form button:hover,.dm-engagement-reply-context button:hover
) {background:var(--s411-ui-surface-hover)!important}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-comment-author textarea,.dm-comment-edit-form textarea
)::placeholder {color:var(--s411-ui-muted)!important;opacity:1}
html[data-s411-effective-theme="dark"] body :is(
  .dm-engagement-comment-author textarea,.dm-comment-edit-form textarea,
  .dm-engagement-prompt,.dm-engagement-drawer-head>button
):focus-visible {outline:2px solid var(--s411-ui-focus)!important;outline-offset:2px!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-comment-author textarea:focus {
  background:var(--s411-ui-field)!important;border-color:var(--s411-ui-focus)!important;
  box-shadow:0 0 0 2px rgba(255,119,124,.19)!important;
}
html[data-s411-effective-theme="dark"] body .dm-engagement-sheet-handle span {background:var(--s411-ui-subtle)!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-comment-row-actions button:hover,
html[data-s411-effective-theme="dark"] body .dm-engagement-comment-row-actions button:focus-visible {color:var(--s411-ui-text)!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-comment-row-actions button.is-danger {color:var(--s411-ui-warning)!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-comment-actions>span {color:var(--s411-ui-warning)!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-comment-form .dm-button-primary,
html[data-s411-effective-theme="dark"] body .dm-comment-edit-form button[data-dm-comment-edit-save] {background:var(--s411-ui-brand-active)!important;border-color:var(--s411-ui-brand-active)!important;color:#fff!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-prompt:disabled {background:var(--s411-ui-surface)!important;color:var(--s411-ui-subtle)!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-match-context[data-state="live"] .dm-engagement-match-now>span {background:#53252f!important;color:#ffe5e7!important}
html[data-s411-effective-theme="dark"] body .dm-engagement-comments-empty.is-match .dm-engagement-empty-icon {color:var(--s411-ui-text)!important}
@media (max-width:720px){
  html[data-s411-effective-theme="dark"] body .dm-engagement-drawer-panel{max-height:calc(100dvh - 12px)}
  html[data-s411-effective-theme="dark"] body .dm-engagement-comment-form{padding-bottom:max(14px,env(safe-area-inset-bottom))}
}
@media (prefers-reduced-motion:reduce){
  .s411-ui-dialog,.s411-ui-action{transition:none!important}
}
@media (forced-colors:active){
  .s411-ui-card,.s411-ui-dialog,.s411-ui-action,.s411-ui-field{border:1px solid CanvasText}
}

/* Soccer 411 v0.19.53: compact, content-driven conversation modal.
 * A single shared dialog serves articles, feeds and matches. It grows with
 * comments until the body scrolls; the composer stays available below.
 * Uses central appearance tokens to support System/Light/Dark automatically.
 */
body .dm-engagement-drawer-panel {
  height:auto;
  min-height:0;
  max-height:min(76dvh,680px);
}
body .dm-engagement-drawer-head,
body .dm-engagement-comment-form {flex:0 0 auto}
body .dm-engagement-comments {
  flex:0 1 auto;
  min-height:0;
  max-height:calc(min(76dvh,680px) - 212px);
  overflow-y:auto;
  overscroll-behavior:contain;
}
body .dm-engagement-comments-empty.s411-conversation-empty {
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  max-width:470px;
  margin:0 auto;
  padding:20px 16px 18px;
  text-align:center;
}
body .s411-conversation-empty-icon {
  display:grid;
  place-items:center;
  flex-shrink:0;
  width:48px;
  height:48px;
  border-radius:50%;
  background:var(--s411-ui-surface-raised);
  color:var(--s411-ui-muted);
}
body .s411-conversation-empty strong {
  color:var(--s411-ui-text);
  font-size:17px;
  line-height:1.25;
  letter-spacing:-.02em;
}
body .s411-conversation-question {
  color:var(--s411-ui-text);
  font-size:13px;
  line-height:1.45;
  font-weight:550;
}
body .s411-conversation-invite {
  color:var(--s411-ui-muted);
  font-size:11px;
  line-height:1.5;
}
body .dm-engagement-comments-empty.is-match.s411-conversation-empty {
  padding:15px 14px 14px;
}
body .dm-engagement-comments-empty.is-match.s411-conversation-empty .s411-conversation-question {
  color:var(--s411-ui-text);
  font-size:13px;
}
body .dm-engagement-comments-empty.is-match.s411-conversation-empty .s411-conversation-invite {
  color:var(--s411-ui-muted);
  font-size:11px;
}
@media(max-width:720px){
  body .dm-engagement-drawer-panel {
    height:auto;
    max-height:min(86dvh,760px);
  }
  body .dm-engagement-comments {
    max-height:calc(min(86dvh,760px) - 202px);
  }
  body .dm-engagement-comments-empty.s411-conversation-empty {
    padding:15px 12px;
    gap:7px;
  }
  body .s411-conversation-empty-icon{width:42px;height:42px}
  body .s411-conversation-empty strong{font-size:15px}
  body .s411-conversation-question{font-size:12px}
}
@media(max-height:520px){
  body .dm-engagement-drawer-panel{max-height:calc(100dvh - 16px)}
  body .dm-engagement-comments{max-height:calc(100dvh - 185px)}
  body .dm-engagement-comments-empty.s411-conversation-empty{padding:8px;gap:5px}
  body .s411-conversation-empty-icon{width:32px;height:32px}
  body .s411-conversation-empty-icon svg{width:20px;height:20px}
}

/* Avatar-less comments must still use the available conversation width. */
body .dm-engagement-comment > div {min-width:0;overflow-wrap:anywhere}
body .dm-engagement-comment > img[hidden] + div {grid-column:1 / -1}

/* Soccer 411 v0.19.56 — Matchday Predictor / How it works.
 * The legacy stylesheet styles .dm-predictor-steps > ARTICLE, while the
 * initial site-wide dark audit mistakenly targeted > DIV. Match the actual
 * markup and use central appearance tokens rather than another fixed palette.
 * Scoped to this route so approved fixtures, articles and homepage are intact.
 */
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page {
  color:var(--s411-ui-text);
  color-scheme:dark;
}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page :is(
  .dm-predictor-steps > article,
  .dm-predictor-rules-card,
  .dm-predictor-how-grid > article,
  .dm-predictor-pool-explainer,
  .dm-predictor-rules
) {
  background:var(--s411-ui-surface)!important;
  background-image:none!important;
  border-color:var(--s411-ui-line)!important;
  color:var(--s411-ui-text)!important;
}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page :is(
  .dm-predictor-how-hero h1,
  .dm-predictor-steps h2,
  .dm-predictor-rules-card h2,
  .dm-predictor-how-grid h2,
  .dm-predictor-pool-explainer h2,
  .dm-predictor-rules h2,
  .dm-predictor-pool-explainer article strong,
  .dm-predictor-scoring-table strong
) {color:var(--s411-ui-text)!important;}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page :is(
  .dm-predictor-how-hero p,
  .dm-predictor-steps p,
  .dm-predictor-rules-card p,
  .dm-predictor-how-grid p,
  .dm-predictor-pool-explainer p,
  .dm-predictor-rules li,
  .dm-predictor-scoring-table span
) {color:var(--s411-ui-muted)!important;}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page :is(
  .dm-predictor-scoring-table > div,
  .dm-predictor-pool-explainer > div > article
) {
  background:var(--s411-ui-surface-raised)!important;
  background-image:none!important;
  color:var(--s411-ui-text)!important;
  border-color:var(--s411-ui-line)!important;
}
/* Keep score examples and numbered steps distinctive, but ensure text is legible. */
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page .dm-predictor-example {
  background:#142f28!important;
  color:#f5fff9!important;
  border-color:#426a59!important;
}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page .dm-predictor-example :is(span,strong) {color:#f5fff9!important;}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page .dm-predictor-steps article>b {
  background:#245342!important;
  color:#fff!important;
}
html[data-s411-effective-theme="dark"] body .dm-predictor-how-page :is(a,button):focus-visible {
  outline:2px solid var(--s411-ui-focus)!important;
  outline-offset:3px!important;
}

/* v0.19.60: Soccer 411 CI button contract. Components opt in to these classes. */
:root { --s411-button-primary:#EF0107;--s411-button-primary-hover:#c90005;--s411-button-secondary:#273244;--s411-button-special:#D9A73B;--s411-button-success:#09866C; }
.s411-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;border-radius:10px;border:1px solid transparent;font-weight:800;text-decoration:none;cursor:pointer;min-height:38px;padding:8px 13px;}
.s411-button--primary{background:var(--s411-button-primary);color:#fff;border-color:var(--s411-button-primary)}
.s411-button--primary:hover{background:var(--s411-button-primary-hover);border-color:var(--s411-button-primary-hover)}
.s411-button--secondary{background:var(--s411-button-secondary);color:#fff;border-color:var(--s411-ui-line)}
.s411-button--banker{background:var(--s411-ui-surface-raised);color:var(--s411-ui-text);border-color:var(--s411-ui-line)}
.s411-button--banker.is-active{background:var(--s411-button-special);border-color:var(--s411-button-special);color:#261a00}
.s411-button--success{background:var(--s411-button-success);border-color:var(--s411-button-success);color:#fff}
.s411-button:focus-visible{outline:3px solid var(--s411-ui-focus);outline-offset:2px}
.s411-button:disabled{cursor:not-allowed;opacity:.55}

/* v0.20.2: Soccer 411 interface branding uses red across all appearance modes. */
:root{--s411-ui-brand-active:#EF0107;--s411-ui-brand-active-hover:#C90006;--s411-ui-brand-on-active:#FFFFFF}
html[data-s411-effective-theme="dark"]{--s411-ui-brand-active:#EF0107;--s411-ui-brand-active-hover:#FF424A;--s411-ui-brand-on-active:#FFFFFF}
