/* Chance me: the pieces the approved mock (docs/mocks/chance-me/round5/
   chance-me.html) draws that Tailwind utilities don't: headings, cards, band
   pills, the sentences and the strip, the key, the segmented toggle, tabs,
   the ladder and its tooltip, the program page's panels, sharing.
   Colours are the site's tokens (core/static/core/css/input.css), plus two
   of the chart's own: blue is the student and nothing else (--you), and the
   line most people who got in cleared is the site's red, dashed (--wall).
   It sits in the components layer, so a template's Tailwind utilities still
   win (w-[130px] on a .ch-field). */

@layer components {
  .ch {
    --offer: #178A68; --wash: rgba(23, 138, 104, .14); --track: #EEF0EC;
    --wall: #A93E2C;
    --you: #2459D6; --you-zone: rgba(36, 89, 214, .10); --you-tint: #E8EEFB;
    --wait: #B9BFBA; --none: #8B948F;
  }
  .ch [hidden] { display: none !important; }

  .ch-h1 { font-family: var(--font-serif); font-size: 27px; line-height: 1.12; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; margin: 0; }
  .ch-h1.xl { font-size: 30px; }
  .ch-h2 { font-family: var(--font-serif); font-size: 21px; line-height: 1.2; font-weight: 600; letter-spacing: -.005em; margin: 0; }
  .ch-lead { font-size: 16.5px; line-height: 1.5; color: var(--color-muted); margin: 12px 0 0; max-width: 60ch; }
  .ch-fine { font-size: 13px; color: var(--color-faint); margin: 0; }
  .ch-label { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--color-faint); }
  .ch-you-c { color: var(--you); }
  @media (min-width: 768px) {
    .ch-h1 { font-size: 34px; }
    .ch-h1.xl { font-size: 46px; }
  }

  .ch .btn { font-size: 15px; border-radius: 10px; padding: 13px 18px; }
  .ch-field { display: block; width: 100%; border: 1px solid var(--color-line-strong); border-radius: 9px; padding: 10px 12px; font-size: 15px; background: var(--color-card); color: var(--color-body); }
  .ch-field::placeholder { color: #B5BCB7; font-weight: 500; }
  .ch-field:focus { outline: 2px solid var(--color-pine); outline-offset: 1px; }
  select.ch-field { width: auto; padding: 7px 30px 7px 10px; font-size: 14px; font-weight: 600; }

  .ch-card { display: block; width: 100%; text-align: left; background: var(--color-card); border: 1px solid var(--color-line); border-radius: 12px; padding: 14px 16px; box-sizing: border-box; color: inherit; text-decoration: none; }

  /* A result card: name and band, the sentences, the strip, "See full details". */
  .ch-rcard { display: block; background: var(--color-card); border: 1px solid var(--color-line); border-radius: 14px; padding: 16px 16px 0; color: inherit; text-decoration: none; }
  a.ch-rcard { transition: border-color .15s, box-shadow .15s; }
  a.ch-rcard:hover { border-color: var(--color-pine); box-shadow: 0 8px 22px -14px rgba(7, 13, 28, .35); }
  a.ch-rcard:focus-visible { outline: 2px solid var(--color-pine); outline-offset: 2px; }
  .ch-card-more { display: flex; align-items: center; gap: 6px; margin: 14px -16px 0; padding: 11px 16px 12px; border-top: 1px solid var(--color-line); font-size: 14px; font-weight: 600; color: var(--color-pine); }
  .ch-card-more .arr { transition: transform .15s; }
  a.ch-rcard:hover .ch-card-more { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #AADEC9; }
  a.ch-rcard:hover .ch-card-more .arr { transform: translateX(3px); }
  @media (min-width: 768px) {
    .ch-rcard { padding: 20px 22px 0; }
    .ch-card-more { margin: 16px -22px 0; padding: 12px 22px 13px; }
  }
  @media (prefers-reduced-motion: reduce) { a.ch-rcard, .ch-card-more .arr { transition: none; } }
  /* The card a program page's "+" chip just added: scrolled to clear of the
     sticky navbar, and lit up for a moment. */
  .ch-rcard { scroll-margin-top: 88px; }
  .ch-rcard:target { animation: ch-added 2.6s ease-out; }
  @keyframes ch-added { from, 45% { border-color: var(--color-pine); box-shadow: 0 0 0 4px #AADEC9; } }
  @media (prefers-reduced-motion: reduce) { .ch-rcard:target { animation: none; border-color: var(--color-pine); } }

  /* The sentences: the line, then (bold, on its own line) how far you are. */
  .ch-verdict { font-family: var(--font-serif); font-size: 19.5px; line-height: 1.32; letter-spacing: -.003em; color: var(--color-body); text-wrap: pretty; margin: 0; }
  .ch-verdict.big { font-size: 24px; line-height: 1.25; }
  .ch-verdict b { display: block; font-weight: 700; }
  .ch-verdict .extra { display: block; margin-top: 6px; font-family: var(--font-sans); font-size: 15px; line-height: 1.45; color: var(--color-muted); }
  .ch-verdict.big .extra { font-size: 16px; }
  @media (min-width: 768px) {
    .ch-verdict { font-size: 21px; }
    .ch-verdict.big { font-size: 30px; }
  }

  /* The strip (drawn by chances.js). Its height is kept while it draws. */
  .ch-strip { position: relative; width: 100%; min-height: 94px; user-select: none; }
  .ch-strip.big { min-height: 148px; }
  .ch-strip svg { display: block; overflow: visible; }
  .ch-strip text { font-family: var(--font-sans); }
  .ch-timeline { position: relative; min-height: 80px; }
  .ch-timeline svg { display: block; overflow: visible; }
  .ch-timeline text { font-family: var(--font-sans); }

  /* The key: every swatch in the same box, centred on its label. Phone: two
     even columns. Wide: one row. */
  .ch-key { display: grid; grid-template-columns: max-content max-content; justify-content: start; align-items: center; gap: 5px 22px; font-size: 12.5px; line-height: 18px; color: var(--color-muted); }
  .ch-key span { display: inline-flex; align-items: center; gap: 7px; }
  .ch-key i { display: grid; place-items: center; flex: none; width: 16px; height: 14px; }
  .ch-key i::before { content: ""; display: block; }
  .ch-key .k-mid::before { width: 16px; height: 10px; border-radius: 2px; background: var(--offer); }
  .ch-key .k-tail::before { width: 16px; height: 10px; border-radius: 2px; background: var(--wash); box-shadow: inset 0 0 0 1px rgba(23, 138, 104, .35); }
  .ch-key .k-line::before { width: 2.5px; height: 14px; background: repeating-linear-gradient(to bottom, var(--wall) 0 3.5px, transparent 3.5px 5.5px); }
  .ch-key .k-you::before { width: 10px; height: 10px; border-radius: 50%; background: var(--you); }
  .ch-key .you { color: var(--you); font-weight: 600; }
  /* The program page's key says its green as sentences: on a phone each
     gets its own row, the line and You share the last. */
  .ch-key.long { display: flex; flex-wrap: wrap; gap: 5px 18px; }
  .ch-key.long .w { flex-basis: 100%; align-items: flex-start; color: var(--color-body); }
  .ch-key.long .w i { margin-top: 2px; }
  @media (min-width: 768px) {
    .ch-key { display: flex; flex-wrap: wrap; gap: 6px 18px; }
    .ch-key.long .w { flex-basis: auto; }
  }

  /* Band pills */
  .ch-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
  .ch-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .ch-b-most { color: #0E6B54; background: #E4F5EE; border-color: #AADEC9; }
  .ch-b-half { color: #1C2523; background: #F7F7F4; border-color: #CBD1CA; }
  .ch-b-few { color: #8F6215; background: #F9F1E1; border-color: #E3CD9E; }
  .ch-b-low { color: #A93E2C; background: #FAEDE9; border-color: #E4B4A9; }
  .ch-b-none { color: #5C6764; background: #fff; border-color: #CBD1CA; border-style: dashed; }

  /* Segmented toggle (radios or links) */
  .ch-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: #EBEDE7; border-radius: 10px; padding: 4px; }
  .ch-seg > a, .ch-seg > label { display: block; text-align: center; border-radius: 7px; padding: 7px 10px; font-size: 14px; font-weight: 600; color: var(--color-muted); white-space: nowrap; cursor: pointer; text-decoration: none; }
  .ch-seg > a[aria-current="true"], .ch-seg > label:has(input:checked) { background: #fff; color: var(--color-pine); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
  .ch-seg > label:has(input:focus-visible) { outline: 2px solid var(--color-pine); outline-offset: 1px; }
  .ch-seg input { position: absolute; opacity: 0; pointer-events: none; }

  /* Tabs */
  .ch-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--color-line); }
  .ch-tabs button { border: 0; background: none; padding: 10px 0; font-size: 14.5px; font-weight: 600; color: var(--color-faint); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
  .ch-tabs button[aria-selected="true"] { color: var(--color-pine); border-color: var(--color-pine); }

  .ch-radio { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--color-line); border-radius: 10px; background: #fff; font-size: 15px; cursor: pointer; }
  .ch-radio:has(input:checked) { border-color: var(--color-pine); box-shadow: inset 0 0 0 1px var(--color-pine); }
  .ch-radio input { margin-top: 4px; accent-color: var(--color-pine); }
  .ch-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--color-pine); background: #fff; border: 1px solid var(--color-line-strong); border-radius: 999px; padding: 6px 12px; text-decoration: none; cursor: pointer; }
  .ch-chip:hover { border-color: var(--color-pine); }
  .ch-link { font-size: 13.5px; font-weight: 600; color: var(--color-pine); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #AADEC9; background: none; border: 0; padding: 0; cursor: pointer; }
  .ch-link:hover { text-decoration-color: var(--color-pine); }
  .ch-error { font-size: 14px; color: var(--color-fix); background: var(--color-fix-tint); border: 1px solid var(--color-fix-line); border-radius: 9px; padding: 9px 12px; }

  /* A course in the top 6: counted (ticked) or not. */
  .ch-ct { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; font-size: 13px; font-weight: 600; white-space: nowrap; }
  .ch-ct.on { color: var(--color-works); }
  .ch-ct.off { color: var(--color-faint); }
  .ch-ct i { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 11px; }
  .ch-ct.on i { background: var(--color-works-tint); border: 1px solid var(--color-works-line); }
  .ch-ct.off i { border: 1px dashed var(--color-line-strong); }

  /* The ladder: one row per point of average. Rows at or above the line
     are tinted, the line is a red dashed rule, the student's row is blue. */
  .ch-viz { position: relative; }
  .ch-ladder { display: grid; gap: 2px; }
  .ch-lrow, .ch-lhead { display: grid; grid-template-columns: 76px minmax(0, 1fr) 40px 64px; align-items: center; gap: 10px; }
  .ch-lrow { padding: 5px 8px; border-radius: 8px; outline: none; cursor: pointer; }
  .ch-lrow:hover:not(.you), .ch-lrow:focus-visible:not(.you) { box-shadow: inset 0 0 0 1px var(--color-line-strong); }
  .ch-lrow:focus-visible { outline: 2px solid var(--color-pine); outline-offset: 1px; }
  .ch-lrow.up { background: var(--color-mint-tint); }
  .ch-lrow.up .bar { background: #D3EDE2; }
  .ch-lrow.you { background: var(--you); color: #fff; box-shadow: 0 4px 12px -6px rgba(36, 89, 214, .6); }
  .ch-lrow .lab { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--color-muted); white-space: nowrap; }
  .ch-lrow.you .lab { color: #fff; font-weight: 700; }
  .ch-lrow .cnt { font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; color: var(--color-body); white-space: nowrap; }
  .ch-lrow.you .cnt { color: #fff; font-weight: 700; }
  .ch-lrow .bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--track); }
  .ch-lrow.you .bar { background: rgba(255, 255, 255, .28); }
  .ch-lrow .bar i { display: block; flex: none; height: 100%; border-radius: 4px; background: var(--offer); }
  .ch-lrow.you .bar i { background: #8FE6C8; }
  .ch-lrow .oth { font-size: 12.5px; color: var(--color-faint); text-align: right; font-variant-numeric: tabular-nums; }
  .ch-lrow.you .oth { color: #DCE5FA; }
  .ch-lrow.under .lab { font-style: italic; }
  .ch-lhead { padding: 0 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--color-faint); white-space: nowrap; }
  .ch-lhead span:nth-child(n+3) { text-align: right; }
  .ch-lline { position: relative; height: 0; border-top: 2px dashed var(--wall); margin: 4px 0; }
  .ch-lline span { position: absolute; right: 6px; top: -10px; background: #fff; padding: 0 6px; font-size: 11.5px; font-weight: 700; color: var(--wall); line-height: 18px; }

  .ch-tip { position: absolute; z-index: 10; pointer-events: none; background: #fff; border: 1px solid var(--color-line); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; color: var(--color-muted); box-shadow: 0 10px 24px -12px rgba(7, 13, 28, .4); min-width: 190px; white-space: nowrap; }
  .ch-tip .h { font-weight: 600; color: var(--color-body); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
  .ch-tip .r { display: flex; align-items: center; gap: 7px; line-height: 1.65; }
  .ch-tip .r i { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
  .ch-tip .r b { color: var(--color-body); font-variant-numeric: tabular-nums; min-width: 22px; }

  table.ch-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
  table.ch-table th { text-align: right; font-size: 11.5px; font-weight: 600; color: var(--color-faint); padding: 6px 4px; border-bottom: 1px solid var(--color-line); }
  table.ch-table td { text-align: right; padding: 6px 4px; border-bottom: 1px solid #F0F1EE; color: var(--color-body); }
  table.ch-table th:first-child, table.ch-table td:first-child { text-align: left; }
  table.ch-table tr.you td { background: var(--you-tint); color: var(--you); font-weight: 700; }

  /* The program page: the verdict card, then Beyond your average and When
     offers came beside the ladder. */
  .ch-vcard { background: var(--color-card); border: 1px solid var(--color-line); border-radius: 16px; padding: 18px 16px 16px; }
  .ch-per100 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--color-line); font-size: 15px; }
  .ch-per100 .of { font-size: 13px; color: var(--color-faint); }
  .ch-beyond { background: var(--color-mint-tint); border: 1px solid var(--color-mint-line); border-radius: 16px; padding: 18px 16px; }
  .ch-beyond .why { font-size: 14.5px; line-height: 1.5; color: #2F4440; margin: 8px 0 0; }
  .ch-reqs { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
  .ch-reqs li { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; align-items: center; background: #fff; border: 1px solid var(--color-mint-line); border-radius: 12px; padding: 10px 12px; }
  .ch-reqs .t { font-size: 15px; font-weight: 600; line-height: 1.3; margin: 0; }
  .ch-reqs .t .opt { font-weight: 500; color: var(--color-faint); }
  /* A program page row's title is the link to the school's page that says
     so, with a ↗ after its last word: a background in the end padding, so
     it never wraps onto a line alone (owner, 2026-10-25). */
  .ch-src { color: inherit; text-decoration: underline; text-decoration-color: var(--color-works-line); text-decoration-thickness: 1.5px; text-underline-offset: 3px; padding-right: 16px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5h5v5M9.5 2.5l-7 7' fill='none' stroke='%238B948F' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right center / 11px 11px; }
  .ch-src:hover { text-decoration-color: var(--color-pine); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5h5v5M9.5 2.5l-7 7' fill='none' stroke='%23003D39' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
  .ch-src:focus-visible { outline: 2px solid var(--color-pine); outline-offset: 2px; border-radius: 3px; }
  /* The planner's verb on a row AcceptMe helps with: a solid button, the
     only filled thing in the box, so it reads as the thing to press
     (owner, 2026-10-25). */
  .ch-act { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 15px; border-radius: 999px; background: var(--color-pine); color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.5; text-decoration: none; }
  .ch-act:hover { background: var(--color-pine-hover); }
  .ch-act .ar { transition: transform .15s; }
  .ch-act:hover .ar { transform: translateX(2px); }
  .ch-act:focus-visible { outline: 2px solid var(--color-pine); outline-offset: 2px; }
  /* The results page's block: the rows by verb, names only, and one
     button for them all, a little bigger (owner, 2026-10-25). */
  .ch-kinds { margin: 12px 0 0; display: grid; gap: 8px; }
  .ch-kind { background: #fff; border: 1px solid var(--color-mint-line); border-radius: 12px; padding: 12px 14px 13px; min-width: 0; }
  .ch-kind .k { font-size: 15px; font-weight: 700; line-height: 1.3; margin: 0; }
  .ch-kind ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
  .ch-kind li { position: relative; padding-left: 13px; font-size: 14px; line-height: 1.4; color: #2F4440; }
  .ch-kind li::before { content: ""; position: absolute; left: 1px; top: .58em; width: 5px; height: 5px; border-radius: 50%; background: var(--color-works-line); }
  .ch-kind .opt { color: var(--color-faint); }
  .ch-kind .for { display: block; font-size: 12.5px; color: var(--color-faint); }
  .ch-act.all { margin-top: 14px; padding: 10px 18px; font-size: 14.5px; }
  .ch-date { text-align: center; border-right: 1px solid var(--color-line); padding-right: 10px; line-height: 1.1; }
  .ch-date b { display: block; font-size: 15px; font-weight: 700; color: var(--color-body); white-space: nowrap; margin: 1px 0; }
  .ch-date small { display: block; font-size: 11px; color: var(--color-faint); }
  .ch-when { background: var(--color-card); border: 1px solid var(--color-line); border-radius: 16px; padding: 18px 16px; }
  .ch-when .s { font-size: 14.5px; line-height: 1.5; color: var(--color-muted); margin: 8px 0 0; }
  @media (min-width: 768px) {
    .ch-vcard { padding: 26px 28px 22px; }
    .ch-beyond, .ch-when { padding: 24px 26px; }
    .ch-kinds { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  }

  /* Sharing: the laptop's box (the preview and the link) and Save image. */
  .ch-share { margin: auto; border: 0; padding: 0; background: var(--color-card); color: var(--color-body); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border-radius: 16px; box-shadow: 0 30px 70px -20px rgba(7, 13, 28, .5); }
  .ch-share::backdrop { background: rgba(7, 13, 28, .55); }
  .ch-x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--color-faint); padding: 0 4px; cursor: pointer; }
  .ch-preview { border: 1px solid var(--color-line); border-radius: 12px; overflow: hidden; }
  .ch-preview img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; background: var(--track); }
  .ch-preview-cap { background: #F2F3F0; padding: 9px 13px 10px; font-size: 14px; line-height: 1.35; }
  .ch-textlink { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 4px; font-size: 14px; font-weight: 600; color: var(--color-pine); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #AADEC9; cursor: pointer; }
  .ch-textlink:hover { text-decoration-color: currentColor; }
}
