/* ==========================================================================
   Markets: the list page (rail, heading, toolbar, featured slip, card grid), the category pictures and picker, and the cards the circle page shares.
   Breakpoints are the shared ones (layout.css): 1000 and below the rail is a drawer, 1180 and below it is narrower, 640 and below it is one column.
   ========================================================================== */

/* ---------- a category's picture: natural colours on whatever it sits on, never a forced tile ---------- */
.cat-ico { display: block; object-fit: contain; flex: none; user-select: none; -webkit-user-drag: none; }
.thumb-cat { width: var(--s, 44px); height: var(--s, 44px); display: block; }
.thumb-cat .cat-ico { width: 100%; height: 100%; }

/* the list has its own search box: the header's would be a second one */
body.mk-list .search, body.mk-list .search-mobile { display: none !important; }

/* ---------- the page: rail + main ---------- */
.mk-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.mk-layout[data-rail="closed"] { grid-template-columns: minmax(0, 1fr); }
.mk-layout[data-rail="closed"] .mk-rail { display: none; }
.mk-main { min-width: 0; }
@media (max-width: 1499px) { .mk-layout { grid-template-columns: 280px minmax(0, 1fr); } }
@media (max-width: 1180px) { .mk-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 18px; } }
@media (max-width: 1000px) { .mk-layout, .mk-layout[data-rail="closed"] { grid-template-columns: minmax(0, 1fr); } .mk-rail { display: none; } }

/* ---------- the rail ---------- */
.mk-rail { --rbg: var(--card); position: sticky; top: calc(var(--stuck-h) + var(--stick-gap)); max-height: calc(var(--view-h) - var(--stuck-h) - var(--dock-h) - 2 * var(--stick-gap)); overflow-y: auto; overscroll-behavior: contain;
  min-width: 0; background: var(--rbg); border: var(--bw) solid var(--line-soft); border-radius: var(--r-2); }
.mk-rail-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px 12px; background: var(--rbg); border-bottom: var(--bw) solid var(--line-soft); }
.mk-rail-list { list-style: none; margin: 0; padding: 0; }
.mk-rrow { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 68px; padding: 11px 14px 11px 11px; border-left: 5px solid transparent; border-bottom: 1px solid var(--line-soft); color: var(--text); text-decoration: none; }
.mk-rrow:hover { background: color-mix(in srgb, var(--text) 7%, var(--rbg)); }
.mk-rrow.sel { background: color-mix(in srgb, var(--lime) 17%, var(--rbg)); border-left-color: var(--lime); }
.mk-rrow.sel .mk-rq { font-weight: 700; }
.mk-rrow:focus-visible { outline-offset: -3px; }
.mk-rtxt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mk-rq { font-size: 14.5px; line-height: 1.25; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mk-rsub { font-size: 12px; line-height: 1.3; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-rch { display: flex; flex-direction: column; align-items: flex-end; max-width: 92px; min-width: 0; line-height: 1.1; }
.mk-rch b { font-family: var(--f-display); font-size: 21px; font-weight: 700; letter-spacing: -.04em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-rch b.mk-rwin { font-size: 14px; letter-spacing: -.01em; }
.mk-rch small { font-size: 11px; color: var(--text-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-rail-none { padding: 18px 16px; color: var(--text-3); font-size: 14px; }
.mk-rail-note { margin: 0; padding: 12px 16px 14px; font-size: 12px; color: var(--text-3); }
.mk-rail-note:empty { display: none; }

/* the drawer a narrow screen gets instead */
.mk-drawer-back { place-items: stretch start; padding: 0; }
.mk-drawer { --rbg: var(--slip); max-width: min(420px, 100%); min-height: 100%; margin: 0; border-radius: 0; padding: 16px 0 24px; animation: none; }
.mk-drawer .cp-top { padding: 0 16px; }
.mk-drawer .mk-rail-head { position: static; }
.mk-drawer .mk-rail-list { border-top: 0; }

/* ---------- heading ---------- */
.mk-top { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; margin-bottom: 20px; }
.mk-titles { min-width: 0; }
.mk-title { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(46px, 7.2vw, 92px); line-height: .9; letter-spacing: -.055em; color: var(--text); }
.mk-tag { margin: 8px 0 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(18px, 2.3vw, 30px); letter-spacing: -.03em; color: var(--text-2); }
.mk-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mk-acts .btn { min-height: 46px; }
.mk-propose { font-size: 14px; padding-inline: 20px; }
.mk-drawerbtn { display: none; }
@media (max-width: 1000px) { .mk-railbtn { display: none; } .mk-drawerbtn { display: inline-flex; } }
@media (max-width: 640px) { .mk-top { align-items: stretch; } .mk-acts { width: 100%; } .mk-acts .btn { flex: 1 1 0; justify-content: center; } .mk-acts .mk-propose { flex: 1 1 100%; order: 3; } }       /* (Markets and Your bets share a row, Propose a bet has the next one: the cards start sooner) */

/* ---------- toolbar ---------- */
.mk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
.mk-search { position: relative; flex: 1 1 280px; min-width: 0; display: flex; align-items: center; }
.mk-search > svg { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.mk-search input { width: 100%; min-width: 0; height: 46px; padding: 0 42px 0 42px; font: inherit; font-size: 15px; color: var(--text); background: var(--bg-2); border: var(--bw) solid var(--line-input); border-radius: var(--r-1); text-overflow: ellipsis; }
.mk-search input::placeholder { color: var(--text-3); text-overflow: ellipsis; }
.mk-search input:focus { outline: none; border-color: var(--focus); box-shadow: 3px 3px 0 var(--lime-shadow); }
.mk-search input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mk-search kbd { position: absolute; right: 12px; font-family: var(--f-mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; }
.mk-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 100%; padding: 3px; background: var(--bg-2); border: var(--bw) solid var(--line); border-radius: var(--r-1); }
.mk-seg button { min-height: 40px; padding: 0 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text-2); background: transparent; border: 0; border-radius: 2px; white-space: nowrap; }
.mk-seg button:hover { color: var(--text); }
.mk-seg button[aria-pressed="true"] { background: var(--text); color: var(--inv); }
.mk-cat { display: inline-flex; align-items: center; gap: 9px; min-height: 46px; max-width: 100%; padding: 0 14px 0 10px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); background: var(--bg-2); border: var(--bw) solid var(--line); border-radius: var(--r-1); }
.mk-cat:hover { border-color: var(--text-3); }
.mk-cat-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-cat-all { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; font-family: var(--f-mono); font-size: 10.5px; font-weight: 700; color: var(--text-2); border: 1.5px solid var(--line); border-radius: 50%; }
.mk-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.mk-sort select { min-height: 46px; width: auto; padding-right: 30px; font-size: 14px; }
.mk-sort.off { opacity: .55; }
.mk-clear { min-height: 44px; padding: 0 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text-2); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.mk-clear:hover { color: var(--text); }
.mk-clear[hidden] { display: none; }
@media (max-width: 640px) {
  .mk-bar > .mk-seg { flex: 1 1 100%; } .mk-bar > .mk-cat { flex: 1 1 200px; } .mk-bar > .mk-sort { flex: 1 1 150px; }
  .mk-seg button { flex: 1 1 auto; padding: 0 8px; }
  .mk-cat { justify-content: flex-start; } .mk-cat svg:last-child { margin-left: auto; }
  .mk-sort { justify-content: space-between; } .mk-sort select { flex: 1; }
}
.mk-count { margin: 0 0 14px; min-height: 16px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.mk-err { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; padding: 12px 14px; border: var(--bw) solid var(--verm); border-radius: var(--r-1); background: color-mix(in srgb, var(--verm) 12%, var(--bg)); font-size: 14px; }
.mk-err svg { vertical-align: -2px; color: var(--verm); }

/* ---------- the buttons on a slip: they only open the market with that side chosen ---------- */
.mk-pick.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.mk-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 48px; padding: 0 12px; font: inherit; font-size: 16px; font-weight: 700; color: #0E0C0A; border: 1.5px solid #0E0C0A; border-radius: var(--r-1); box-shadow: 3px 3px 0 #0E0C0A; transition: transform .07s, box-shadow .07s; }
.mk-btn.y { background: var(--lime); color: var(--lime-ink); } .mk-btn.n { background: var(--verm); color: var(--verm-ink); }
.mk-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 #0E0C0A; }
.mk-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 #0E0C0A; }
.mk-pick.outs { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.mk-out { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-width: 0; min-height: 54px; padding: 7px 11px; font: inherit; color: var(--paper-ink); background: var(--paper-2); border: 1.5px solid var(--paper-line); border-radius: var(--r-1); text-align: left; }
.mk-out:hover { border-color: #0E0C0A; background: color-mix(in srgb, var(--lime) 22%, var(--paper)); }
.mk-out .nm { max-width: 100%; font-size: 13.5px; font-weight: 600; }
.mk-out b { font-family: var(--f-display); font-size: 21px; letter-spacing: -.04em; }
.mk-more { display: inline-block; margin-top: 8px; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--paper-mute); text-decoration: underline; text-underline-offset: 3px; }
.mk-more:hover { color: var(--paper-ink); }
.mk-result { display: flex; flex-direction: column; gap: 3px; min-height: 58px; justify-content: center; padding: 9px 12px; border: 1.5px dashed var(--paper-line); border-radius: var(--r-1); }
.mk-result b { font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.mk-result .lbl { color: var(--paper-mute); }
.mk-result.won { border: 1.5px solid #0E0C0A; background: color-mix(in srgb, var(--lime) 28%, var(--paper)); }
.mk-result.void { background: color-mix(in srgb, var(--verm) 9%, var(--paper)); }

/* ---------- a card ---------- */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 18px; align-items: stretch; }
.mk-card { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 18px 20px 20px; border: var(--bw) solid #0E0C0A; border-radius: 12px; box-shadow: var(--sh-2); cursor: pointer; transition: transform .1s, box-shadow .1s; }
.mk-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--lime-shadow); }
.mk-card.settled { background: var(--paper-2); }
.mk-card.pop { animation: stampIn .5s cubic-bezier(.2, 1.5, .4, 1) 1; }
.mk-head { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.mk-head + * { margin-top: auto; }
.mk-meta { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.mk-kick { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--paper-mute); overflow-wrap: anywhere; }
.mk-q { margin: 0; font-family: var(--f-display); font-size: 23px; line-height: 1.06; letter-spacing: -.04em; color: var(--paper-ink); overflow-wrap: anywhere; }
.mk-q a, .mk-fq a { color: inherit; text-decoration: none; }
.mk-q a:hover, .mk-fq a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.mk-sub { display: block; font-size: 14px; color: var(--paper-mute); overflow-wrap: anywhere; }
.mk-sub .num { color: var(--paper-ink); font-weight: 600; }
.mk-sub .where { white-space: nowrap; }
.mk-skel { min-height: 190px; border: var(--bw) dashed var(--line-soft); border-radius: 12px; background: var(--card); }

/* ---------- the featured slip ---------- */
#mk-feat { container-type: inline-size; }
.mk-feature { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) clamp(140px, 18%, 200px); gap: 20px 26px; align-items: center; min-height: 200px; margin-bottom: 20px; padding: 22px 24px; border: var(--bw) solid #0E0C0A; border-radius: 14px; box-shadow: var(--sh-2); cursor: pointer; }
.mk-feat-main { display: flex; align-items: flex-start; gap: 16px; min-width: 0; }
.mk-fq { margin: 4px 0 6px; font-family: var(--f-display); font-size: clamp(24px, 2.7vw, 38px); font-size: clamp(22px, 3.3cqi, 38px); line-height: 1; letter-spacing: -.045em; color: var(--paper-ink); overflow-wrap: anywhere; }
.mk-feat-quote { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mk-chance { display: flex; align-items: flex-end; gap: 16px; min-width: 0; }
.mk-chance-n { flex: none; display: flex; flex-direction: column; gap: 6px; }
.mk-chance-n b { font-family: var(--f-display); font-size: clamp(44px, 4.8vw, 64px); font-weight: 800; line-height: .9; letter-spacing: -.05em; color: var(--paper-ink); }
.mk-chance-n .lbl { color: var(--paper-mute); max-width: 150px; overflow-wrap: anywhere; }
.mk-spark { flex: 1; min-width: 0; color: var(--lime-deep); }
.mk-spark-svg { display: block; width: 100%; height: 40px; overflow: visible; }
.mk-spark-dates { display: flex; justify-content: space-between; margin-top: 3px; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--paper-mute); }
.mk-feature .mk-btn { min-height: 50px; }

/* the picture: three separate layers (the stack, the speech bubble, and the category's own icon on the front slip) so each can move on its own */
.mk-art { position: relative; justify-self: end; width: 100%; max-width: 200px; aspect-ratio: 1; }
.mk-art-stack { position: absolute; left: 0; bottom: 0; width: 90%; height: 90%; }
.mk-art-stack img, .mk-art-speech img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mk-art-ico { position: absolute; left: 43%; top: 43%; width: 28%; height: 35%; transform: rotate(15deg); }
.mk-art-ico .cat-ico { width: 100%; height: 100%; }
.mk-art-speech { position: absolute; right: -4%; top: -8%; width: 48%; height: 52%; }
.mk-art-speech-in { width: 100%; height: 100%; transition: transform .18s ease; }
.mk-feature:hover .mk-art-speech-in { transform: translateY(-3px) rotate(1.5deg); }
/* once, when a different market is featured: the stack settles, the bubble follows, the icon fades in. Nothing loops. */
.mk-enter .mk-art-stack { animation: mk-stack .18s ease-out 1 both; }
.mk-enter .mk-art-speech-in { animation: mk-bubble .18s ease-out .12s 1 both; }
.mk-enter .mk-art-ico { animation: mk-icon .15s ease-out .06s 1 both; }
@keyframes mk-stack { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes mk-bubble { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes mk-icon { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .mk-enter .mk-art-stack, .mk-enter .mk-art-speech-in, .mk-enter .mk-art-ico, .mk-card.pop { animation: none; }
  .mk-art-speech-in, .mk-btn, .mk-card { transition: none; }
  .mk-feature:hover .mk-art-speech-in, .mk-card:hover, .mk-btn:hover { transform: none; }
}

/* the featured slip follows the room it has, not the screen: with the rail open it is narrower than the window */
@container (max-width: 860px) {
  .mk-feature { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 20px; }
  .mk-art { display: none; }
  .mk-feat-quote { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
  .mk-chance { flex: 1 1 240px; } .mk-feat-quote > .mk-pick, .mk-feat-quote > .mk-result { flex: 1 1 280px; } .mk-feat-quote > .mk-more { flex: 1 1 100%; margin-top: 0; }
}
@container (max-width: 560px) { .mk-spark { display: none; } .mk-feature { padding: 18px; } }

/* ---------- the category field of a form, and the picker ---------- */
.cat-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.cat-more { border-style: dashed; }
.cp-back { align-items: start; }
.cp-win { max-width: 780px; display: flex; flex-direction: column; padding: 20px 20px 14px; }
.cp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cp-title { margin: 0; font-family: var(--f-display); font-size: 28px; letter-spacing: -.04em; color: var(--paper-ink); }
.cp-search { margin-bottom: 12px; } .cp-search .input { height: 46px; width: 100%; }
.cp-scroll { min-height: 0; max-height: calc(var(--view-h) - 270px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 3px 6px; }
.cp-h { margin: 18px 0 8px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--paper-mute); }
.cp-h:first-child { margin-top: 4px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.cp-opt, .cp-all { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 48px; padding: 6px 10px; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--paper-ink); text-align: left; background: var(--paper); border: var(--bw) solid var(--paper-line); border-radius: var(--r-1); }
.cp-opt:hover, .cp-all:hover { background: var(--paper-2); border-color: #0E0C0A; }
.cp-opt.on, .cp-all.on { background: var(--lime); color: var(--lime-ink); border-color: #0E0C0A; box-shadow: 2px 2px 0 #0E0C0A; }
.cp-opt .cat-ico { width: 32px; height: 32px; }
.cp-name { min-width: 0; overflow-wrap: anywhere; }
.cp-all { width: 100%; }
.cp-all-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; font-family: var(--f-mono); font-size: 12px; font-weight: 700; border: 1.5px solid currentColor; border-radius: 50%; }
.cp-none { margin: 18px 4px; font-size: 15px; color: var(--paper-mute); }
.cp-count { margin: 10px 2px 0; font-size: 13px; color: var(--paper-mute); min-height: 18px; }

/* ---------- a bet's own page: where its category shows, and how it says it is over ---------- */
.crumb-cat { display: inline-flex; align-items: center; gap: 6px; }
.crumb-cat .cat-ico { width: 20px; height: 20px; }
.mp-result { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; min-height: 60px; margin-top: 14px; padding: 12px 16px; border: var(--bw) solid var(--line); border-radius: var(--r-1); }
.mp-result b { font-family: var(--f-display); font-size: 24px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.mp-result-note { flex: 1 1 260px; font-size: 14px; color: var(--text-2); }
.mp-result.won { border-color: var(--pos); background: color-mix(in srgb, var(--pos) 11%, transparent); }
.mp-result.won b { color: var(--pos); }
.mp-result.void { border-style: dashed; border-color: var(--text-3); }
.mp-result.wait { border-color: var(--verm); background: color-mix(in srgb, var(--verm) 9%, transparent); }
.orow-big.won { background: color-mix(in srgb, var(--pos) 12%, transparent); box-shadow: inset 4px 0 0 var(--pos); }
.orow-big.won .nm { font-size: 22px; }
.quote-state { margin: -6px 0 12px; font-size: 12.5px; color: var(--paper-mute); }
.quote-state.ok::before { content: '✓ '; color: var(--lime-deep); font-weight: 700; }
.no-hold { margin: 6px 0 14px; padding: 14px; border: 1.5px dashed var(--paper-line); border-radius: var(--r-1); font-size: 14px; line-height: 1.45; color: var(--paper-ink); }
.no-hold > b { display: block; margin-bottom: 4px; font-size: 16px; }
.no-hold p { margin: 0; } .no-hold .linkish { margin-left: 0; font-size: inherit; color: var(--paper-ink); font-weight: 600; } .no-hold a { color: var(--paper-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.pe-cat { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-size: 14px; color: var(--paper-mute); }
.pe-cat b { color: var(--paper-ink); }
