/* Spinner — a carnival midway: candy stripes, bulbs, big wheels. */
.cc-wrap { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 22px; align-items: center; }
.cc-main { display: grid; place-items: center; min-width: 0; }
/* the paint and edge wheels sit in a box: keep them centred */
#wbox { display: grid; justify-items: center; width: 100%; }
/* after a tap, no focus ring on the puzzle (keyboard users still get it) */
:root[data-cc-input="pointer"] .cc-wrap :focus-visible { outline: none; }
/* wide screens: when the answer side grows tall (pad, tally, chart), the wheel stays in view beside it */
@media (min-width: 761px) { .cc-main { align-self: start; position: sticky; top: 84px; } }
.cc-side { display: grid; gap: 14px; align-content: center; min-width: 0; }
.cc-wrap.is-busy .cc-choice, .cc-wrap.is-busy .cc-lane { cursor: progress; }
.cc-wheel { display: block; width: min(100%, 360px); height: auto; touch-action: manipulation; }
.cc-wheel.small { width: 100%; max-width: 150px; }
.cc-rim { fill: #2B1B3D; }
.cc-bulb { fill: #FFE7A3; animation: ccBulb 1.2s steps(1) infinite; }
.cc-bulb.b { animation-delay: .6s; }
@keyframes ccBulb { 50% { fill: #FFB84D; } }
.cc-edge { fill: none; stroke: #2B1B3D; stroke-width: 3; }
.cc-lines line { stroke: #2B1B3D; stroke-width: 2.2; }
.cc-hub { fill: #FFC94D; stroke: #2B1B3D; stroke-width: 3; }
.cc-pointer { fill: #FFC94D; stroke: #2B1B3D; stroke-width: 3; stroke-linejoin: round; transform-box: fill-box; transform-origin: 50% 0; }
.cc-wheel.tick .cc-pointer { animation: ccTick .12s ease-out; }
@keyframes ccTick { 50% { transform: rotate(-12deg); } }
.cc-sym { stroke: rgba(43, 27, 61, .35); stroke-width: .8; }
.cc-wheel[role="application"] { cursor: pointer; }
.cc-wheel[role="application"]:focus { outline: none; }
.cc-wheel[role="application"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 50%; }
.cc-sec.cursor path:first-child { stroke: #6A44C9; stroke-width: 5; stroke-dasharray: 6 4; }
.cc-sec.locked { cursor: not-allowed; }
/* drag the edge: rim ticks, a round handle you can grab */
.cc-ticks line { stroke: #2B1B3D; stroke-width: 2; stroke-linecap: round; opacity: .55; }
.cc-handle { cursor: grab; touch-action: none; }
.cc-handle circle { fill: #FFC94D; stroke: #2B1B3D; stroke-width: 3; }
.cc-handle .cc-handle-hit { fill: transparent; stroke: none; }
.cc-handle path { stroke: #2B1B3D; stroke-width: 1.6; stroke-linecap: round; }
.cc-edgebox .cc-wheel { cursor: pointer; }
.cc-wheel[role="slider"]:focus { outline: none; }
.cc-wheel[role="slider"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 50%; }
.cc-wheel[role="slider"]:focus-visible .cc-handle circle:not(.cc-handle-hit) { stroke: #6A44C9; stroke-width: 4; }
.cc-lock rect { fill: #2B1B3D; } .cc-lock path { stroke: #2B1B3D; stroke-width: 1.8; }
@media (prefers-reduced-motion: reduce) { .cc-bulb, .cc-wheel.tick .cc-pointer { animation: none; } }
[data-motion="reduced"] .cc-bulb, [data-motion="reduced"] .cc-wheel.tick .cc-pointer { animation: none; }

/* a color name with its chip; inline so the text after it ("?") stays on the baseline */
.cc-sw { width: 20px; height: 20px; vertical-align: -.2em; flex: none; }
.cc-cname { font-weight: 800; white-space: nowrap; }
.cc-cname .cc-sw { margin-right: .22em; }
.cc-frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.02; vertical-align: middle; font-family: var(--f-math); font-weight: 800; font-size: max(.92em, 14px); margin: 0 .12em; position: relative; }
.cc-frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .15em; }
.cc-big { font: 800 1.6rem var(--f-math); }

/* choices */
.cc-choices { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.cc-choice { min-height: 52px; min-width: 0; padding: 8px 12px; border-radius: 14px; border: 2px solid rgba(43, 27, 61, .2); background: #fff; color: #2B1B3D; font: 700 1rem/1.2 var(--f-ui); box-shadow: 0 3px 0 rgba(43, 27, 61, .14); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; }
.cc-choice .cc-sw { flex: none; }
.cc-choice.on { border-color: #2B1B3D; background: #FFF3CF; box-shadow: 0 3px 0 #2B1B3D; }
.cc-choice.out, .cc-pick.out { opacity: .45; text-decoration: line-through; cursor: not-allowed; }
.cc-choice.right, .cc-pick.right { border-color: #1E8A57; background: #E1F4EA; box-shadow: 0 3px 0 #1E8A57; opacity: 1; text-decoration: none; }

/* the likelihood ladder: certain at the top, impossible at the bottom, with a 0-to-1 scale beside it */
.cc-line { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; width: 100%; max-width: 300px; justify-self: center; }
.cc-line .cc-choices { display: flex; flex-direction: column; gap: 6px; }
.cc-line .cc-choice { min-height: 46px; padding: 6px 12px; border-radius: 12px; }
.cc-scale { order: -1; position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 13px 0; font: 700 .9rem var(--f-math); color: #5E6472; }
.cc-scale::before { content: ''; position: absolute; top: 22px; bottom: 22px; left: 50%; width: 4px; margin-left: -2px; border-radius: 2px; background: linear-gradient(0deg, #8E8A99, #E5484D 50%, #1E8A57); }
.cc-scale > span { position: relative; z-index: 1; background: var(--board, #fff); padding: 1px 2px; line-height: 1.1; }

/* tally */
.cc-tally { background: #FBF6EE; border-radius: 16px; padding: 12px 14px; border: 1.5px solid rgba(43, 27, 61, .12); color: #2B1B3D; }
.cc-tally-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.cc-tally-h span { font-family: var(--f-math); color: #5E6472; }
.cc-bars { display: grid; grid-template-columns: max-content minmax(0, 1fr) 42px; gap: 7px 8px; align-items: center; }
.cc-barrow { display: contents; }
.cc-barlab { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: .9rem; }
.cc-track { position: relative; height: 18px; border-radius: 9px; background: #EFE7DA; overflow: visible; }
.cc-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--f) * 100%); border-radius: 9px; transition: width .12s linear; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.cc-band { position: absolute; top: -5px; bottom: -5px; min-width: 6px; border-radius: 6px; background: repeating-linear-gradient(135deg, rgba(30, 138, 87, .30) 0 4px, rgba(30, 138, 87, .12) 4px 8px); border: 2px solid #1E8A57; }
.cc-pred { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 3px dashed #2B1B3D; }
.cc-n { font: 800 1rem var(--f-math); text-align: right; }
/* the share-so-far chart: a line that wobbles, then settles on the dashed "share of the wheel" */
.cc-lln { margin-top: 10px; }
.cc-lln > svg { display: block; width: 100%; height: auto; overflow: visible; }
.cc-lln text { font: 700 14px var(--f-math); fill: #5E6472; }
.cc-lln-bg { fill: #fff; stroke: rgba(43, 27, 61, .12); }
.cc-lln-grid { stroke: rgba(43, 27, 61, .12); stroke-width: 1; }
.cc-lln-exp { stroke: #2B1B3D; stroke-width: 2; stroke-dasharray: 6 4; }
.cc-lln-under { fill: none; stroke: #2B1B3D; stroke-width: 5.5; stroke-linejoin: round; stroke-linecap: round; }
.cc-lln-line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.cc-lln-dot { stroke: #2B1B3D; stroke-width: 2; }
.cc-lln-cap { margin: 4px 0 0; font-size: .9rem; line-height: 1.35; color: #464B57; }
.cc-nw { white-space: nowrap; }
.cc-lln .cc-key { display: inline-block; width: 22px; height: 8px; vertical-align: middle; margin: 0 2px 0 6px; overflow: visible; }
.cc-lln .cc-key:first-child { margin-left: 0; }
.cc-key .cc-lln-key { stroke: #2B1B3D; stroke-width: 3.5; stroke-linecap: round; }
.cc-fill.blank { box-shadow: inset 0 0 0 1.5px rgba(43, 27, 61, .45); }
.cc-note { margin: 8px 0 0; font-size: .9rem; color: #464B57; }
.cc-note:empty { display: none; }
.cc-exp { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .9rem; color: #5E6472; }
.cc-btn { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; border: 2px solid #2B1B3D; background: #FFC94D; color: #2B1B3D; font: 800 .92rem var(--f-ui); box-shadow: 0 3px 0 #2B1B3D; }
.cc-btn:active { transform: translateY(2px); box-shadow: none; }
.cc-btn.quiet { background: #fff; border-color: rgba(43, 27, 61, .25); box-shadow: 0 2px 0 rgba(43, 27, 61, .2); }
.cc-btn[disabled], .cc-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.cc-tools { display: flex; align-items: center; gap: 10px; justify-content: center; }
.cc-tools-l { font-weight: 700; color: #464B57; }
.cc-tools .cc-btn { font-size: 1.4rem; line-height: 1; }
.cc-n2 { min-width: 2ch; text-align: center; font: 800 1.6rem var(--f-math); color: #2B1B3D; }
.cc-tip { margin: 0; font-size: .92rem; color: #5E6472; text-align: center; }
/* once the answer is in, the keys are no use: fold them away so the show has the room */
.cc-wrap.is-done .np-keys { display: none; }

/* compare + inverse */
.cc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.cc-pair figure { margin: 0; display: grid; justify-items: center; gap: 4px; min-width: 0; }
.cc-pair figcaption { font: 800 1rem var(--f-display); color: #2B1B3D; }
.cc-pair .cc-wheel { width: 100%; max-width: 250px; }
/* compare / paint-to-match: each spinner's 100-spin count right under it */
.cc-mini { width: 100%; max-width: 250px; }
.cc-mini .cc-tally { padding: 8px 10px; border-radius: 12px; }
.cc-mini .cc-tally-h { margin-bottom: 4px; }
.cc-mini .cc-bars { grid-template-columns: max-content minmax(0, 1fr) 34px; gap: 4px 6px; }
.cc-t-match .cc-pair { align-items: end; }
.cc-tri { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.cc-pick { display: grid; justify-items: center; gap: 4px; min-width: 0; padding: 10px 6px; border-radius: 16px; border: 2px solid rgba(43, 27, 61, .18); background: #fff; font: 800 .95rem/1.15 var(--f-ui); color: #2B1B3D; box-shadow: 0 3px 0 rgba(43, 27, 61, .14); }
.cc-pick.on { border-color: #2B1B3D; background: #FFF3CF; box-shadow: 0 3px 0 #2B1B3D; }
.cc-tally.static .cc-fill { transition: none; }

/* derby */
.cc-derby { width: 100%; display: grid; gap: 8px; }
.cc-dice { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; flex-wrap: wrap; }
.cc-die svg { width: 44px; height: 44px; display: block; }
.cc-sum { font: 800 1.15rem var(--f-math); color: #2B1B3D; min-width: 3ch; }
.cc-lanes { display: grid; gap: 3px; }
.cc-lane { position: relative; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 6px; min-height: 44px; width: 100%; padding: 0 10px 0 4px; border-radius: 12px; border: 2px solid transparent; background: repeating-linear-gradient(90deg, #F6E9D5 0 calc(100% / 8 - 2px), #E8D7BC calc(100% / 8 - 2px) calc(100% / 8)); color: #2B1B3D; text-align: left; font: inherit; }
.cc-lane:nth-child(odd) { background-color: #F1E1C8; }
.cc-lane > b { font: 800 1rem var(--f-math); text-align: center; }
.cc-lanes.static .cc-lane { min-height: 32px; }
button.cc-lane { cursor: pointer; }
button.cc-lane:hover:not([disabled]) { border-color: rgba(43, 27, 61, .35); }
.cc-lane.on, .cc-lane[aria-checked="true"] { border-color: #2B1B3D; box-shadow: inset 0 0 0 2px #FFC94D; }
.cc-lane.out { opacity: .5; cursor: not-allowed; }
.cc-lane.is-out { cursor: not-allowed; background: repeating-linear-gradient(135deg, #EDE6DA 0 8px, #E2D9CA 8px 16px); }
.cc-lane.is-out .cc-horse { opacity: .35; }
.cc-outtag { position: absolute; left: 48px; top: 50%; transform: translateY(-50%); font: 800 .875rem var(--f-ui); font-style: normal; letter-spacing: .04em; text-transform: uppercase; color: #6B5A43; }
.cc-lane.win { background: #FFF3CF; border-color: #E0A82E; }
.cc-lane.right { border-color: #1E8A57; box-shadow: inset 0 0 0 2px #9ED3B6; opacity: 1; }
.cc-track2 { position: relative; height: 30px; }
/* the finish line: a checkered strip at the end of every racing lane */
.cc-lanes:not(.static) .cc-track2::after { content: ''; position: absolute; top: -5px; bottom: -5px; right: -7px; width: 7px; background: repeating-conic-gradient(#2B1B3D 0 25%, #fff 0 50%) 0 0 / 7px 7px; border-radius: 2px; }
.cc-derby.hist .cc-track2::after, .cc-derby.hist .cc-outtag { display: none; }
/* many rolls: each lane is a bar, and a dashed mark shows what the math expects */
.cc-hbar, .cc-etick { display: none; position: absolute; }
.cc-derby.hist .cc-hbar { display: block; left: 0; top: 7px; bottom: 7px; width: calc(var(--x, 0) * (100% - 40px) + 20px); border-radius: 0 8px 8px 0; background: rgba(194, 37, 92, .28); border: 1.5px solid rgba(194, 37, 92, .55); border-left: 0; transition: width .1s linear; }
.cc-derby.hist .cc-etick { display: block; top: -4px; bottom: -4px; left: calc(var(--e, 0) * (100% - 40px) + 20px); width: 0; border-left: 3px dashed #2B1B3D; z-index: 1; }
.cc-horse { position: absolute; top: 0; left: calc(var(--x) * (100% - 40px)); width: 40px; height: 30px; transition: left .1s ease-out; }
.cc-horse svg { width: 100%; height: 100%; display: block; }
.cc-horse.hop { animation: ccHop .18s ease-out; }
@keyframes ccHop { 50% { transform: translateY(-5px); } }
.cc-cnt { min-width: 0; font: 800 .9rem var(--f-math); color: #5E6472; text-align: right; }
.cc-cnt:empty { display: none; }
.cc-derby.hist .cc-cnt { min-width: 3ch; }
.cc-t-judge .cc-choices { grid-template-columns: 1fr; }
.cc-t-judge .cc-choice { justify-content: flex-start; text-align: left; min-height: 48px; }

/* the 36 rolls */
.cc-gridwrap { overflow-x: auto; max-width: 100%; }
.cc-grid { border-collapse: separate; border-spacing: 3px; margin: 0 auto; font: 700 1rem var(--f-math); color: #2B1B3D; }
.cc-grid th { width: 40px; height: 36px; background: #2B1B3D; color: #fff; border-radius: 8px; }
.cc-grid td { position: relative; width: 40px; height: 36px; text-align: center; background: #FBF6EE; border-radius: 8px; border: 1.5px solid rgba(43, 27, 61, .12); }
.cc-grid.hidden-cells td > span { visibility: hidden; }
.cc-grid td.hl { background: #FFC94D; border-color: #2B1B3D; }
.cc-grid td.ada { background: #FDE2E3; border-color: #E5484D; }
.cc-grid td.bo { background: #DCE9FE; border-color: #2F7CF6; }
.cc-mark { position: absolute; top: 1px; right: 1px; line-height: 0; }
.cc-mark .cc-sw { width: 12px; height: 12px; vertical-align: top; }
.cc-legend { display: flex; justify-content: center; gap: 16px; margin: 8px 0 0; font-weight: 700; font-size: .92rem; color: #464B57; }
.cc-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* short laptops (sticky dock): wheel, ladder and pad sized so they start above the dock */
@media (min-width: 761px) and (max-height: 800px) {
  .cc-wheel { width: min(100%, 360px, calc(100vh - 345px)); }
  .cc-t-fair .cc-wheel, .cc-t-build2 .cc-wheel { width: min(100%, 360px, calc(100vh - 375px)); }
  .cc-pair .cc-wheel { max-width: min(250px, calc(100vh - 400px)); }
  .cc-line .cc-choice { min-height: 44px; }
  .np-display { min-height: 56px; }
  .np-k { min-height: 46px; }
  .cc-lanes:not(.static) .cc-lane, .cc-lane { min-height: 44px; }
  /* mid-race nobody taps a lane, so all eleven close up to fit above the dock */
  .cc-derby.racing .cc-lane { min-height: 31px; }
  .cc-derby.racing .cc-track2 { height: 26px; }
  .cc-derby.racing .cc-horse { height: 26px; width: 35px; left: calc(var(--x) * (100% - 35px)); }
}
@media (max-width: 760px) {
  .cc-wrap { grid-template-columns: 1fr; gap: 14px; }
  /* short phones: keep the whole wheel visible above the sticky action dock */
  .cc-wheel { width: min(100%, 300px, max(190px, calc(100vh - 410px))); }
  .cc-pair .cc-wheel { max-width: 170px; }
  /* "paint B to match A": B is the one you tap, so it gets the room */
  .cc-t-match .cc-pair { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; }
  .cc-t-match .cc-pair figure:last-child .cc-wheel { max-width: 240px; }
  .cc-grid th, .cc-grid td { width: 36px; height: 32px; }
  /* the wheel and its answer side by side, so the choices (or the pad) sit next to the spinner, above the dock */
  .cc-t-likely, .cc-t-most { grid-template-columns: minmax(0, 1fr) minmax(124px, 42%); gap: 12px 10px; }
  .cc-t-predict, .cc-t-spins { grid-template-columns: minmax(0, 1fr) minmax(150px, 54%); gap: 12px 10px; }
  .cc-t-likely > .cc-side, .cc-t-most > .cc-side, .cc-t-predict > .cc-side, .cc-t-spins > .cc-side { display: contents; }
  .cc-t-likely .cc-tally, .cc-t-likely .cc-exp, .cc-t-most .cc-tally, .cc-t-most .cc-exp,
  .cc-t-predict .cc-tally, .cc-t-predict .cc-exp, .cc-t-spins .cc-tally, .cc-t-spins .cc-exp { grid-column: 1 / -1; }
  .cc-t-predict #pad, .cc-t-spins #pad { grid-column: 2; grid-row: 1; align-self: center; }
  .cc-t-likely .cc-line { grid-template-columns: 22px minmax(0, 1fr); gap: 5px; }
  .cc-t-likely .cc-line .cc-choice { padding: 4px 6px; font-size: .9rem; }
  .cc-t-most .cc-choices { display: flex; flex-direction: column; gap: 6px; align-self: center; }
  .cc-t-most .cc-choice { min-height: 48px; }
  /* phone number pads: a little tighter (keys stay at least 44 px) */
  .np { width: 100%; gap: 8px; }
  .np-display { min-height: 54px; font-size: 1.7rem; }
  .np-keys { gap: 6px; }
  .np-k { min-height: 46px; }
  /* count the ways: the pad comes first, the 36 rolls under it */
  .cc-t-ways > .cc-side { order: -1; }
  .cc-t-ways #pad .np { margin: 0 auto; max-width: 300px; }
  /* three answers in one row */
  .cc-t-compare .cc-choices, .cc-t-pair .cc-choices, .cc-t-judge .cc-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .cc-t-compare .cc-choice, .cc-t-pair .cc-choice, .cc-t-judge .cc-choice { padding: 6px 6px; min-height: 48px; }
  .cc-t-judge .cc-choice { justify-content: center; text-align: center; flex-direction: column; gap: 2px; font-size: .9rem; line-height: 1.15; }
  /* derby and "which sum": the dice (or the choices) come before the tall lanes */
  .cc-t-derby > .cc-side, .cc-t-pair > .cc-side { order: -1; }
  /* mid-race nobody taps a lane, so the lanes close up and all eleven fit above the dock */
  .cc-derby.racing .cc-lane { min-height: 31px; }
  .cc-derby.racing .cc-track2 { height: 26px; }
  .cc-derby.racing .cc-horse { height: 26px; width: 35px; left: calc(var(--x) * (100% - 35px)); }
  /* the experiment buttons share one row */
  .cc-exp { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .cc-exp > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .cc-exp .cc-btn { padding: 0 6px; line-height: 1.1; }
}
@media (max-width: 380px) {
  .cc-grid { border-spacing: 2px; font-size: .92rem; }
  .cc-grid th, .cc-grid td { width: 31px; height: 27px; }
  .cc-t-judge .cc-choice { font-size: .875rem; padding: 4px; }
  /* narrow phones: the question and the 36 rolls fill the screen, so the three answers go first */
  .cc-t-judge > .cc-side { order: -1; }
  /* the two longest paint instructions leave a little less room for the wheel */
  .cc-t-fair .cc-wheel, .cc-t-build2 .cc-wheel { width: min(100%, 300px, max(180px, calc(100vh - 445px))); }
  .cc-pick { padding: 8px 4px; font-size: .875rem; }
  .cc-tri { gap: 6px; }
  .cc-die svg { width: 40px; height: 40px; }
  .cc-t-predict, .cc-t-spins { grid-template-columns: minmax(0, 1fr) minmax(146px, 58%); gap: 10px 8px; }
  .np-display { min-height: 48px; font-size: 1.5rem; }
  .np-display.is-empty::before { font-size: .9rem; }
  .np-k { min-height: 44px; font-size: 1.2rem; }
}
:root[data-cc-input="pointer"] .cc-wheel[role="slider"]:focus-visible .cc-handle circle:not(.cc-handle-hit) { stroke: #2B1B3D; stroke-width: 3; }
