:root {
  color: #161616;
  background: #f5f5f2;
  font-family: "National 2", Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-width: 0; }
body { min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.ffk-embed-root {
  container-type: inline-size;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 16px;
}

.ffk-widget, .builder {
  width: min(100%, 760px);
  margin: 0 auto;
  min-width: 0;
}

.widget-card, .builder-card {
  overflow: clip;
  border: 1px solid #d6d6d0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px #1616160d;
}

.widget-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #e7e7e3;
}

.eyebrow, .micro-label {
  display: block;
  margin: 0 0 4px;
  color: #77736c;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .055em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
.widget-title, .builder-title { margin-bottom: 0; font-size: clamp(21px, 4cqi, 27px); line-height: 1.05; }
.widget-body { padding: 18px; }
.widget-footer { padding: 0 18px 18px; }

.hub-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  color: #8d1019;
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.state { padding: 28px 18px; color: #625f58; text-align: center; }
.state strong { color: #272522; display: block; margin-bottom: 8px; }
.state--error { border: 1px solid #e4b5b8; border-radius: 12px; background: #fff5f5; color: #8d1019; }

.button, .button-secondary, .slot-button, .roster-button {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  font-weight: 760;
}
.button { padding: 0 16px; color: white; background: #96151e; }
.button:hover { background: #751018; }
.button-secondary { padding: 0 14px; color: #4d0c11; background: #f4e5e6; }
.button:disabled, .button-secondary:disabled { color: #8c8984; background: #ecebe8; }

.form-score-grid { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(0, 1fr); gap: 18px; align-items: center; }
.form-dial { position: relative; display: grid; aspect-ratio: 1; place-items: center; border-radius: 50%; background: conic-gradient(from 218deg, #a94b4e 0 15%, #c76c58 15% 30%, #b98f44 30% 45%, #849364 45% 60%, #4f7c66 60% 78%, #245c50 78% 100%); box-shadow: inset 0 0 0 8px #f8f2eb, 0 8px 20px #765d441c; }
.form-dial::before { position: absolute; inset: 11%; border-radius: 50%; background: #fffcf8; content: ""; }
.form-dial::after { position: absolute; top: 6%; left: 50%; width: 3px; height: 18%; border-radius: 4px; background: var(--form-color); box-shadow: 0 1px 3px #0004; content: ""; transform: translateX(-50%) rotate(var(--form-angle)); transform-origin: 50% 244%; }
.form-dial__core { position: relative; z-index: 1; display: grid; place-items: center; text-align: center; }
.form-dial__core b { display: block; font-size: clamp(46px, 12cqi, 68px); line-height: .86; }
.form-dial__core span { margin-top: 4px; color: #716d67; font-size: 13px; font-weight: 700; }
.form-dial__core strong { margin-top: 8px; color: var(--form-color); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.form-kicker { margin: 0 0 4px; color: #6d6962; font-size: 14px; font-weight: 750; }
.form-change { margin: 0 0 9px; font-weight: 850; }.form-change--up { color: #2d7058; }.form-change--down { color: #a94b4e; }
.form-copy { margin-bottom: 0; color: #5f5b55; line-height: 1.45; }
.form-components { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.metric { min-width: 0; padding: 10px; border-radius: 10px; background: #f4f3f0; }
.metric span { display: block; overflow-wrap: anywhere; color: #6c6861; font-size: 12px; }
.metric b { display: block; margin-top: 2px; font-size: 18px; }
.match-list { display: grid; gap: 7px; margin: 18px 0 0; padding: 0; list-style: none; }
.match-list li { display: grid; grid-template-columns: 37px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; background: #f7f7f5; }
.outcome { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: white; font-weight: 850; }
.outcome--V { background: #187244; }.outcome--U { background: #76736d; }.outcome--T { background: #9c1620; }
.match-list small { display: block; margin-top: 3px; color: #75716b; }
.form-recent { margin-top: 18px; }.form-recent h2 { margin-bottom: 9px; font-size: 17px; }

.match-heading { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 18px; text-align: center; }
.match-heading > div { display: grid; justify-items: center; gap: 6px; min-width: 0; }.match-heading strong { overflow-wrap: anywhere; font-size: clamp(17px, 4cqi, 23px); }
.match-heading span { color: #77736c; font-size: 13px; font-weight: 800; }
.match-heading > div:last-child { text-align: right; }.match-heading > div:first-child { text-align: left; }
.team-mark { display: grid; width: 42px; height: 42px; place-items: center; object-fit: contain; }.team-mark--fallback { border-radius: 50%; background: #8d1019; color: #fff; font-size: 12px; font-weight: 850; }
.prediction-bars { display: grid; gap: 9px; }
.prediction-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 42px; gap: 10px; align-items: center; }
.prediction-row label { font-weight: 750; }
.prediction-track { height: 12px; overflow: hidden; border-radius: 20px; background: #eceae6; }
.prediction-fill { height: 100%; border-radius: inherit; background: #9d1720; }
.prediction-row:nth-child(2) .prediction-fill { background: #75716b; }.prediction-row:nth-child(3) .prediction-fill { background: #283c75; }
.prediction-row b { text-align: right; }
.prediction-count { margin: 0 0 16px; color: #66615a; font-size: 14px; }
.read-only-notice { margin: 20px 0 0; padding: 12px; border-left: 3px solid #9b1520; background: #faf4f4; color: #5d282b; font-size: 14px; line-height: 1.4; }
.prototype-status { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 18px 0 0; color: #625d56; font-size: 13px; line-height: 1.35; }.prototype-status b { color: #86131c; }
.score-preview { display: inline-block; white-space: nowrap; }
.tip-editor { display: grid; gap: 14px; margin-top: 20px; padding-top: 18px; border-top: 1px solid #e7e7e3; }
.tip-editor h2 { margin: 0; font-size: 18px; }
.score-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: end; text-align: center; }
.score-controls > div { display: grid; min-width: 0; gap: 7px; font-weight: 800; }
.score-controls > div > span { overflow-wrap: anywhere; }
.score-separator { padding-bottom: 11px; color: #6c6861; font-size: 25px; font-weight: 800; }
.score-stepper { display: grid; grid-template-columns: 44px minmax(36px, 1fr) 44px; gap: 5px; align-items: center; }
.score-stepper .button-secondary { width: 44px; padding: 0; font-size: 20px; }
.score-stepper b { min-width: 0; font-size: 26px; line-height: 1; }
.tip-submit, .lineup-submit { justify-self: start; }
.success-state, .write-error { margin: 16px 0 0; padding: 11px 12px; border-radius: 9px; font-size: 14px; line-height: 1.4; }
.success-state { border: 1px solid #b8dcc4; background: #f1faf3; color: #20613d; }
.write-error { border: 1px solid #e4b5b8; background: #fff5f5; color: #87111a; }
.write-error .button-secondary { min-height: 34px; margin: 4px 0 0 5px; }

.lineup-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.lineup-toolbar p { margin: 0; color: #6b6760; font-size: 14px; }.lineup-toolbar p span { display: block; margin-top: 2px; }
.formation-field { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1fr) auto; gap: 9px; align-items: end; margin: 0 0 14px; }
.formation-field label { grid-column: 1 / -1; font-size: 14px; font-weight: 800; }
.formation-field select, .roster-search input { min-width: 0; min-height: 44px; padding: 0 11px; border: 1px solid #bcb9b2; border-radius: 8px; background: #fff; }
.roster-search { display: grid; gap: 6px; margin-bottom: 9px; font-size: 14px; font-weight: 800; }
.lineup-hint { margin: 16px 0 0; color: #5f5b55; font-size: 14px; line-height: 1.4; }
.lineup-submit { margin-top: 16px; }
.empty-roster { grid-column: 1 / -1; margin: 0; padding: 12px; border-radius: 9px; background: #f5f4f1; color: #625f58; }
.pitch { position: relative; width: 100%; min-height: 0; aspect-ratio: .76; overflow: hidden; border: 5px solid #ecf5ec; border-radius: 16px; background: repeating-linear-gradient(90deg, #438d53 0 10%, #4c985a 10% 20%); }
.pitch::before { position: absolute; inset: 4.5% 4%; border: 2px solid #dcefdc; content: ""; pointer-events: none; }
.pitch::after { position: absolute; top: 50%; right: 4%; left: 4%; height: 2px; background: #dcefdc; content: ""; pointer-events: none; }
.slot-button { position: absolute; z-index: 1; width: min(108px, 22cqi); min-height: 82px; padding: 3px; transform: translate(-50%, -50%); color: #fff; background: transparent; text-align: center; }
.slot-button:focus-visible, .slot-button--active { outline: 3px solid #ffdf6d; outline-offset: 2px; }
.player-token { display: grid; justify-items: center; gap: 1px; max-width: 100%; }
.portrait { display: grid; width: 49px; height: 49px; place-items: center; overflow: hidden; border: 2px solid #fff; border-radius: 50%; background: #252525; box-shadow: 0 2px 6px #0005; color: white; font-size: 15px; font-weight: 850; }
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.portrait.image-failed img { display: none; }
.player-token b, .player-token small { max-width: 100%; overflow: hidden; color: #fff; font-size: 11px; line-height: 1.1; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.player-token small { color: #f6e3a3; font-size: 10px; }
.empty-slot { display: grid; width: 38px; height: 38px; place-items: center; border: 2px dashed #dcefdc; border-radius: 50%; background: #175a2c99; color: #fff; font-size: 18px; }
.roster-heading { margin: 18px 0 8px; font-size: 18px; }
.roster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.roster-button { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: center; min-width: 0; padding: 6px; border: 1px solid #deddd8; background: #fff; color: #282624; text-align: left; }
.roster-button:hover { border-color: #9b1520; background: #fff9f8; }.roster-button--chosen { opacity: .56; }
.roster-button .portrait { width: 32px; height: 32px; font-size: 11px; }.roster-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.builder { width: min(100%, 1140px); }
.builder-header { margin-bottom: 18px; }.builder-header p { max-width: 70ch; margin: 9px 0 0; color: #5f5b55; line-height: 1.45; }
.builder-card { padding: 18px; }.module-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.module-card { min-width: 0; padding: 16px; border: 1px solid #d6d6d0; border-radius: 14px; background: #fff; box-shadow: 0 2px 10px #1616160a; }.module-card--selected { border-color: #9b1520; box-shadow: inset 0 3px 0 #9b1520, 0 5px 15px #16161610; }
.module-card__head, .builder-preview__head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }.module-card h2, .builder-preview h2 { margin: 0; font-size: 21px; }.module-card > p { min-height: 42px; color: #625e57; line-height: 1.4; }
.module-card__data { margin: 0 0 22px; padding: 11px; border-radius: 8px; background: #f4f3f0; color: #625e57; font-size: 14px; }.status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 3px 8px; border-radius: 999px; background: #f4e7d7; color: #754c18; font-size: 11px; font-weight: 850; white-space: nowrap; }.status-pill--ready { background: #e0efe6; color: #236346; }
.module-card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }.module-card code { display: block; min-height: 38px; margin-top: 13px; overflow-wrap: anywhere; color: #67625b; font-size: 11px; }
.field { display: grid; gap: 6px; min-width: 0; }.field label { font-weight: 800; }.field select, .field input { min-width: 0; min-height: 44px; padding: 0 11px; border: 1px solid #bcb9b2; border-radius: 8px; background: #fff; }
.builder-preview { margin-top: 18px; }.preview-frame { display: block; width: 100%; height: 520px; min-height: 0; margin-top: 14px; border: 1px solid #cbc9c4; border-radius: 12px; background: #f5f5f2; }
.prototype-note { margin-top: 16px; color: #625f58; font-size: 14px; line-height: 1.4; }

@container (max-width: 500px) {
  .ffk-embed-root { padding: 12px; }
  .widget-header, .widget-body { padding: 14px; }
  .widget-footer { padding: 0 14px 14px; }
  .form-score-grid { grid-template-columns: 118px minmax(0, 1fr); gap: 12px; }
  .form-components { grid-template-columns: 1fr; }
  .match-heading { gap: 6px; }
  .prediction-row { grid-template-columns: 61px minmax(0, 1fr) 38px; gap: 7px; }
  .score-controls { gap: 6px; }.score-stepper { grid-template-columns: 42px minmax(32px, 1fr) 42px; gap: 3px; }.score-stepper .button-secondary { width: 42px; }.score-stepper b { font-size: 23px; }
  .formation-field { grid-template-columns: 1fr; }.formation-field .button-secondary { justify-self: start; }
  .pitch { aspect-ratio: .68; }
  .slot-button { width: min(70px, 20cqi); min-height: 78px; }
  .portrait { width: 39px; height: 39px; }
  .player-token b, .player-token small { overflow: visible; text-overflow: clip; white-space: normal; }
  .player-token b { font-size: 9px; overflow-wrap: anywhere; }.player-token small { font-size: 8px; }
  .roster { grid-template-columns: 1fr; }.roster-button { min-height: 44px; }
  .module-cards { grid-template-columns: 1fr; }.module-card > p { min-height: 0; }.builder-card { padding: 14px; }
}
