/* =========================================================================
   BlinkDeal — the board you read while a deal is running.

   Dressed in Myntra's colours, because that is where every Buy button lands:
   the page a visitor leaves and the page they arrive at should not feel like
   two different products. Myntra's own set - pink #ff3f6c, ink #282c3f,
   border #eaeaec, green #03a685 - with two adjustments, both for contrast:
   the pink is deepened to #c9184a wherever it carries small text (Myntra's
   own #ff3f6c is 3.4:1 on white and fails AA), and the green to #03836a.
   The true logo gradient survives untouched on the brand mark, which carries
   no text and so is held to no ratio.

   The mark itself stays BlinkDeal's struck coin. Borrowing a palette is
   dressing to match the destination; borrowing the M would be wearing
   somebody else's name.

   Green keeps the buyer's meaning it had on Karat Board: money in your
   pocket - here, a coin whose metal is worth more than you would pay.
   ========================================================================= */

:root {
  --m3-primary:        #c9184a;   /* Myntra pink, deepened to pass AA on white */
  --m3-primary-soft:   #ff3f6c;   /* their actual pink, for fills only */
  --m3-on-primary:     #ffffff;
  --m3-primary-container:#ffe9ef;
  --m3-surface:        #f5f5f6;   /* Myntra's page grey */
  --m3-surface-1:      #ffffff;
  --m3-surface-2:      #f5f5f6;
  --m3-surface-3:      #eaeaec;   /* Myntra's border grey */
  --m3-surface-variant:#e4e4e7;
  --m3-on-surface:     #282c3f;   /* Myntra's text ink */
  --m3-on-surface-var: #5f6274;
  --m3-outline:        #94969f;   /* Myntra's secondary text */
  --m3-outline-var:    #eaeaec;
  --m3-error:          #d43d3d;
  --m3-warn:           #b45309;
  --m3-read:           #a8560a;   /* read from Myntra, not chosen by hand */
  --m3-read-soft:      #fdf0e2;
  --m3-ok:             #01755f;   /* Myntra green #03a685, deepened to clear AA
                                    on the page grey as well as on white */
  --m3-ok-soft:        #e3f5f0;
  --gold:              #ff905a;
  /* The logo gradient, decorative only - it sits under an icon, never text. */
  --brand-grad:        linear-gradient(140deg, #f13ab1 0%, #ff3f6c 48%, #fd913c 100%);
  /* Anything that carries small white text uses the deeper pair instead. */
  --fill-grad:         linear-gradient(135deg, #d9295f 0%, #c9184a 100%);
  --foil-grad:         linear-gradient(100deg, #c9184a 0%, #ff3f6c 38%, #f13ab1 52%, #ff3f6c 66%, #fd913c 100%);
  --brand-glow:        rgba(255,63,108,.38);
  --bg-grad:           radial-gradient(1100px 560px at 86% -12%, #ffe9f0 0%, #f5f5f6 58%);
  --shadow-1: 0 1px 2px rgba(40,44,63,.10), 0 1px 3px rgba(40,44,63,.06);
  --shadow-2: 0 2px 6px rgba(40,44,63,.10), 0 8px 20px rgba(40,44,63,.10);
  --shadow-3: 0 12px 34px rgba(40,44,63,.18);
  --r-lg: 24px; --r-md: 16px; --r-sm: 12px;
  --topbar-h: 68px;
  --font: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
  --m3-primary:        #ff7396;
  --m3-primary-soft:   #ff3f6c;
  --m3-on-primary:     #3d0a1c;
  --m3-primary-container:#3d1526;
  --m3-surface:        #14161d;
  --m3-surface-1:      #1c1f2b;
  --m3-surface-2:      #252938;
  --m3-surface-3:      #2f3446;
  --m3-surface-variant:#353a4d;
  --m3-on-surface:     #f0f1f5;
  --m3-on-surface-var: #9ca0ad;
  --m3-outline:        #7c8090;
  --m3-outline-var:    #2c3040;
  --m3-error:          #ff8a8a;
  --m3-warn:           #e0a44a;
  --m3-read:           #ffb066;
  --m3-read-soft:      #3a2a15;
  --m3-ok:             #20c9a6;
  --m3-ok-soft:        #10312a;
  --gold:              #ff905a;
  --brand-grad:        linear-gradient(140deg, #f13ab1 0%, #ff3f6c 48%, #fd913c 100%);
  --fill-grad:         linear-gradient(135deg, #ff3f6c 0%, #e0295f 100%);
  --foil-grad:         linear-gradient(100deg, #ff7396 0%, #ff3f6c 38%, #ffa4bd 52%, #ff3f6c 66%, #fd913c 100%);
  --brand-glow:        rgba(255,63,108,.40);
  --bg-grad:           radial-gradient(1100px 560px at 86% -12%, #2a1622 0%, #14161d 60%);
  --shadow-1: 0 1px 2px rgba(0,0,0,.45);
  --shadow-2: 0 4px 14px rgba(0,0,0,.55);
  --shadow-3: 0 10px 30px rgba(0,0,0,.65);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg-grad);
  background-color: var(--m3-surface);
  color: var(--m3-on-surface);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }

/* =========================================================================
   Topbar
   ========================================================================= */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--m3-surface-1) 90%, var(--m3-primary) 5%);
  backdrop-filter: saturate(1.35) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--m3-primary) 18%, var(--m3-outline-var));
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 6px 18px -12px var(--brand-glow);
}
html[data-theme="dark"] .topbar { box-shadow: 0 6px 20px -14px #000; }

.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; background: var(--brand-grad);
  box-shadow: 0 7px 16px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.38);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
  position: relative; overflow: hidden;
}
.brand:hover .brand-mark {
  transform: translateY(-1px) scale(1.03); filter: brightness(1.06);
  box-shadow: 0 12px 24px -6px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.5);
}

/* The mark is a struck coin: the rim rings, the bolt flashes across it, and a
   band of foil sweeps the face — the three seconds a deal actually lasts,
   drawn once. Karat Board stacks bars; this one gets hit by lightning. */
.an-rim, .an-bolt { transform-box: fill-box; transform-origin: center; }
.brand:hover .an-rim  { animation: an-ring .55s cubic-bezier(.22,1,.36,1) both; }
.brand:hover .an-bolt { animation: an-strike .55s cubic-bezier(.22,1,.36,1) both; }
.brand-mark::after {
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(100deg, transparent 42%, rgba(255,255,255,.55) 50%, transparent 58%);
  transform: translateX(-120%); opacity: 0;
}
.brand:hover .brand-mark::after { animation: an-foil .62s cubic-bezier(.3,.7,.3,1) both; }
@keyframes an-ring {
  0% { transform: scale(.82); opacity: .35; }
  60% { transform: scale(1.07); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes an-strike {
  0% { opacity: .15; transform: scale(.7) translateY(-2px); }
  40% { opacity: 1; transform: scale(1.18); }
  70% { opacity: .55; transform: scale(.97); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes an-foil {
  0% { transform: translateX(-120%); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.1px;
  color: var(--m3-on-surface-var); text-transform: uppercase;
}
.brand-name {
  font-size: 19px; font-weight: 800; letter-spacing: -.3px;
  background: var(--foil-grad); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.rate-pill {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--m3-surface-2); border: 1px solid var(--m3-outline-var);
  font-size: 12px; color: var(--m3-on-surface-var); white-space: nowrap;
}
.rate-pill b { font-size: 14.5px; font-weight: 800; color: var(--m3-on-surface); font-variant-numeric: tabular-nums; }

/* The header status: one pill carrying two facts - how long this picture
   lasts, and how long the session does.

   It was two separate pills, a segmented ring in pink beside a green capsule,
   and they fought: two shapes, two colours, two borders, for one idea. Now it
   is a single container. The ring is a depleting arc rather than a spinning
   wheel, because at this size a dozen segments with gaps read as fuzz, while
   an arc that empties says "time is going" at any size. */
.status {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 4px 13px 4px 5px; border-radius: 999px;
  background: var(--m3-surface-2); border: 1px solid var(--m3-outline-var);
  white-space: nowrap;
}

.status-ring { position: relative; width: 30px; height: 30px; flex: none;
  display: grid; place-items: center; }
.status-ring svg { position: absolute; inset: 0; width: 100%; height: 100%;
  transform: rotate(-90deg); }
.status-ring .sr-bg { fill: none; stroke: var(--m3-outline-var); stroke-width: 3; }
.status-ring .sr-fg {
  fill: none; stroke: var(--m3-primary); stroke-width: 3; stroke-linecap: round;
  transition: stroke-dashoffset .95s linear, stroke .3s;
}
.status-ring b {
  position: relative; font-size: 11px; font-weight: 800; line-height: 1;
  color: var(--m3-on-surface-var); font-variant-numeric: tabular-nums;
}
/* The last ten seconds: arc and number agree that it is nearly up. */
.status.soon .sr-fg { stroke: var(--m3-ok); }
.status.soon b { color: var(--m3-ok); }

.status-text {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; color: var(--m3-on-surface-var);
}
.status-text .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--m3-ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--m3-ok) 55%, transparent);
  animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite;
}

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--m3-outline-var); background: var(--m3-surface-2);
  color: var(--m3-on-surface-var); display: grid; place-items: center;
  transition: transform .12s, background .15s, color .15s, box-shadow .15s;
}
.icon-btn:hover {
  transform: translateY(-1px); box-shadow: var(--shadow-1);
  background: var(--m3-primary-container); color: var(--m3-primary);
}

/* =========================================================================
   Locked state.

   Outside a deal there is nothing on this page anyone can act on, so it does
   not pretend otherwise: the header stays, and everything below it becomes one
   slowly turning wheel. It is honest (nothing is happening) and it gives the
   one person waiting for a deal something better to look at than a paragraph.

   The hub is the way in. It carries no label - the only person who needs it
   already knows where it is.
   ========================================================================= */
.locked {
  min-height: calc(100vh - var(--topbar-h));
  display: grid; place-items: center; align-content: center;
  gap: 8px; padding: 20px; overflow: hidden;
}

.wheel-stage {
  position: relative;
  width: min(58vh, 78vw); height: min(58vh, 78vw);
  display: grid; place-items: center;
}
.wheel { position: relative; width: 100%; height: 100%; }
.wheel svg { width: 100%; height: 100%; display: block; }

.wheel .rim {
  fill: none; stroke: var(--m3-outline-var); stroke-width: 2;
}
.wheel .inner {
  fill: var(--m3-surface); stroke: var(--m3-outline-var); stroke-width: 1.5;
}
.wheel .seg { fill: url(#seg); opacity: .16; }
.wheel .seg:nth-child(odd) { opacity: .30; }
.wheel .tick { stroke: var(--m3-primary); stroke-width: 2; opacity: .35; }

/* Slow while it waits; the whole point is that it is idling, not working. */
.wheel-spin { transform-origin: 200px 200px; animation: turn 26s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

.hub {
  position: absolute; inset: 0; margin: auto;
  width: 27%; height: 27%; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--m3-outline-var);
  background: var(--m3-surface-1);
  color: var(--m3-on-surface-var);
  box-shadow: var(--shadow-2);
  transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .2s, color .2s;
}
.hub svg { width: 34%; height: 34%; }
.hub:hover { transform: scale(1.05); color: var(--m3-primary); box-shadow: var(--shadow-3); }
.hub:active { transform: scale(.97); }
.hub:focus-visible { outline: 2px solid var(--m3-primary); outline-offset: 4px; }
.hub .shackle { transform-box: fill-box; transform-origin: bottom center; transition: transform .25s; }
.hub:hover .shackle { transform: translateY(-1px) rotate(-8deg); }

.locked-words { text-align: center; max-width: 40ch; }
.locked-words h1 {
  margin: 0; font-size: clamp(30px, 6vw, 54px); font-weight: 800;
  letter-spacing: -1.2px; line-height: 1.05;
}
.locked-words h1 b {
  background: var(--foil-grad); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}
.locked-words p {
  margin: 10px 0 0; font-size: 14.5px; color: var(--m3-on-surface-var);
}
.locked-words .resting-meta { font-size: 12px !important; opacity: .8; }

/* Working: the wheel stops idling and starts turning like it means it. */
.locked.working .wheel-spin { animation-duration: 1.1s; }
.locked.working .hub { color: var(--m3-primary); border-color: var(--m3-primary); }
.locked.working .hub .shackle { transform: translateY(-4px) rotate(-100deg); opacity: .5; }

/* =========================================================================
   The key
   ========================================================================= */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--m3-on-surface) 45%, transparent);
  backdrop-filter: blur(4px);
  animation: fade .18s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.keycard {
  width: min(360px, 100%);
  background: var(--m3-surface-1); border: 1px solid var(--m3-outline-var);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  padding: 26px 24px 20px; text-align: center;
  animation: rise .28s cubic-bezier(.22,1,.36,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; } }
.keycard h2 { margin: 0 0 6px; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.keycard p { margin: 0 0 16px; font-size: 13px; color: var(--m3-on-surface-var); }

.key-in {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--m3-outline-var); background: var(--m3-surface-2);
  color: var(--m3-on-surface); font: 700 16px var(--font);
  letter-spacing: 2px; text-align: center;
}
.key-in:focus-visible { outline: 2px solid var(--m3-primary); outline-offset: 1px; }
.keycard.wrong { animation: shake .32s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-7px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}
.key-err { margin: 8px 0 0 !important; color: var(--m3-error) !important; font-weight: 700; }

.key-row { display: flex; gap: 8px; margin-top: 16px; }
.key-row button {
  flex: 1; padding: 11px 14px; border-radius: 999px;
  font: 700 13.5px var(--font); border: 1px solid var(--m3-outline-var);
  transition: transform .12s, box-shadow .15s, filter .15s;
}
.key-cancel { background: var(--m3-surface-2); color: var(--m3-on-surface-var); }
.key-go {
  border-color: transparent; color: #fff; background: var(--fill-grad);
  box-shadow: 0 5px 13px -4px var(--brand-glow);
}
.key-row button:hover { transform: translateY(-1px); }
.key-go:hover { filter: brightness(1.06); }

@media (prefers-reduced-motion: reduce) {
  .wheel-spin { animation: none; }
}

/* Live banner — the one moment the page is allowed to be loud. */
.live-bar {
  display: flex; align-items: center; gap: 10px;
  max-width: 1240px; margin: 0 auto; padding: 9px 24px;
  font-size: 13px; font-weight: 700; color: var(--m3-on-surface);
}
.live-bar b { font-size: 15px; color: var(--m3-primary); font-variant-numeric: tabular-nums; }
.live-left {
  margin-left: auto; font-weight: 800; font-size: 12.5px;
  color: var(--m3-primary);
  background: var(--m3-primary-container);
  border-radius: 999px; padding: 4px 12px;
}
.changed {
  font-size: 11.5px; font-weight: 800; letter-spacing: .2px;
  color: var(--m3-warn); background: color-mix(in srgb, var(--m3-warn) 12%, transparent);
  border-radius: 999px; padding: 4px 11px;
  animation: fadein .25s ease both;
}
@keyframes fadein { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; } }

.live-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--m3-ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--m3-ok) 60%, transparent);
  animation: pulse 2s cubic-bezier(.4,0,.6,1) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--m3-ok) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* =========================================================================
   Deal bar — the one control that changes every answer on the page.
   ========================================================================= */
.dealbar {
  position: sticky; top: var(--topbar-h); z-index: 20;
  background: color-mix(in srgb, var(--m3-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--m3-outline-var);
}
.dealbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 11px 24px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}

.filter-label {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: var(--m3-on-surface-var);
}

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: var(--m3-surface-2); border: 1px solid var(--m3-outline-var);
}
.seg button {
  border: 0; background: transparent; color: var(--m3-on-surface-var);
  font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 6px 14px; border-radius: 999px; line-height: 1;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--m3-on-surface); background: var(--m3-surface-3); }
.seg button[aria-pressed="true"] {
  color: #fff; background: var(--fill-grad);
  box-shadow: 0 4px 10px -3px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.35);
}

/* The purity segment sits beside "In stock", smaller than the deal control -
   it is a narrowing of the board, not the thing that changes every answer. */
.seg.tiny button { padding: 5px 11px; font-size: 12px; font-weight: 700; }
.seg.tiny button[aria-pressed="true"] {
  background: var(--m3-primary-container); color: var(--m3-primary); box-shadow: none;
}

/* The percentage Myntra is actually running wears its own colour, so it never
   looks like something somebody typed. It keeps that colour even when a manual
   choice is active - overriding the deal should not hide what the deal is. */
.seg button.detected[aria-pressed="true"] {
  background: var(--m3-read); color: #fff; box-shadow: var(--shadow-1);
}
/* Addressed by id so it cannot lose a specificity tie with the pressed rule
   above - the two selectors are otherwise weight-for-weight identical, and a
   tie decided by source order is a fragile thing to hang a colour on. */
#blinkSeg button.detected[aria-pressed="false"] {
  color: var(--m3-read);
  background: var(--m3-read-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--m3-read) 45%, transparent);
}
.seg button.detected::before {
  content: "⚡"; font-size: 10px; margin-right: 4px; opacity: .9;
}

.ref { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.mini {
  border: 1px solid var(--m3-outline-var); background: var(--m3-surface-2);
  color: var(--m3-on-surface); border-radius: 999px;
  font: 600 12.5px var(--font); padding: 7px 13px;
}
.mini:focus-visible { outline: 2px solid var(--m3-primary); outline-offset: 1px; }
select.mini { cursor: pointer; max-width: 240px; }
input.mini { width: 64px; font-variant-numeric: tabular-nums; }

/* =========================================================================
   Filters — two rows of chips, both multi-select, nothing hidden.
   ========================================================================= */
.filterbar { max-width: 1240px; margin: 0 auto; padding: 12px 24px 0; }
.chiprow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 10px; }
.chiprow + .chiprow { border-top: 1px solid var(--m3-outline-var); padding-top: 10px; }

.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px 6px 7px; border-radius: 999px;
  background: var(--m3-surface-1); border: 1px solid var(--m3-outline-var);
  color: var(--m3-on-surface); font-size: 13px; font-weight: 600;
  transition: transform .12s, box-shadow .15s, border-color .15s, background .15s;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }

/* Selected filters are TONAL, not foil.
   The gradient is the metal, and Karat Board only ever lets the metal shine -
   the mark, and the rate that wins. Six brands selected at once, each one a
   bar of gold, turned a filter row into the loudest thing on a page whose
   actual subject is the board below it. A tinted container with bronze text
   reads as clearly "on" and lets the eye pass straight over it. */
.chip.is-active {
  background: var(--m3-primary-container);
  border-color: color-mix(in srgb, var(--m3-primary) 30%, var(--m3-outline-var));
  color: var(--m3-primary);
  box-shadow: none;
}
.chip.is-active:hover { box-shadow: var(--shadow-1); }

/* The jeweller marks are Karat Board's, drawn in one hand and one stroke
   weight so fifteen logos in fifteen brand colours cannot fight the board. */
.chip .glyph {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 800; letter-spacing: .2px;
  background: var(--m3-surface-2); color: var(--m3-primary);
}
.chip .glyph svg { width: 19px; height: 19px; display: block; }
.chip.is-active .glyph {
  background: color-mix(in srgb, var(--m3-primary) 14%, transparent);
  color: var(--m3-primary);
}

.chip .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--m3-surface-2); color: var(--m3-on-surface-var);
  font-variant-numeric: tabular-nums;
}
.chip.is-active .count {
  background: color-mix(in srgb, var(--m3-primary) 16%, transparent);
  color: var(--m3-primary);
}

/* Weights are short labels and there are fifteen of them, so no glyph. */
.chip.sm { padding: 5px 12px; font-size: 12.5px; gap: 6px; }
.chip.sm .count { min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
.chip.sm.is-active::before { content: "✓"; font-size: 11px; font-weight: 800; line-height: 1; }

/* Brands take several at once too, but the tick goes BESIDE the mark, never
   over it - the mark is how you recognise the jeweller, and swapping it for a
   checkmark the moment you pick one throws that away exactly when the chip
   matters most. The gold fill already says "selected"; this just confirms it. */
.chip.pick.is-active > span:not(.glyph):not(.count)::before {
  content: "✓ "; font-weight: 800;
}

/* =========================================================================
   Board
   ========================================================================= */
main { max-width: 1240px; margin: 0 auto; padding: 14px 24px 64px; }

.board-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 2px 12px; }
.tally { font-size: 13.5px; color: var(--m3-on-surface-var); }
.tally b { color: var(--m3-on-surface); font-weight: 800; }
.tally .hit { color: var(--m3-ok); font-weight: 800; }
.tally-near { color: var(--m3-warn); font-weight: 700; }

.mini-toggles { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px;
  color: var(--m3-on-surface-var); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 36px; height: 21px; border-radius: 999px; flex: none;
  background: var(--m3-surface-3); position: relative; transition: background .16s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .16s;
}
.switch input:checked + .track { background: var(--m3-primary); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { outline: 2px solid var(--m3-primary); outline-offset: 2px; }

.sheet {
  background: var(--m3-surface-1); border: 1px solid var(--m3-outline-var);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

thead th {
  background: var(--m3-surface-2);
  border-bottom: 1px solid var(--m3-outline-var);
  padding: 0; text-align: right; white-space: nowrap;
}
thead th:first-child { text-align: left; }
thead th button {
  width: 100%; border: 0; background: transparent; color: var(--m3-on-surface-var);
  font-size: 10.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  padding: 12px 14px; display: inline-flex; align-items: center; gap: 5px;
  justify-content: flex-end; transition: color .15s, background .15s;
}
thead th:first-child button { justify-content: flex-start; }
thead th button:hover { color: var(--m3-primary); background: var(--m3-surface-3); }
thead th button .arrow { opacity: 0; font-size: 9px; transition: opacity .15s; }
thead th.sorted button { color: var(--m3-primary); }
thead th.sorted button .arrow { opacity: 1; }
thead th.plain { padding: 12px 14px; }

tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--m3-outline-var);
  text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}
tbody td.left { text-align: left; white-space: normal; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .13s; }
tbody tr:hover td { background: var(--m3-surface-2); }

/* Worth more than you pay. Green is the buyer's colour on both boards. */
tbody tr.hit td { background: color-mix(in srgb, var(--m3-ok) 6%, var(--m3-surface-1)); }
tbody tr.hit:hover td { background: color-mix(in srgb, var(--m3-ok) 11%, var(--m3-surface-1)); }
tbody tr.hit td:first-child { box-shadow: inset 3px 0 0 var(--m3-ok); }

.coin { display: flex; align-items: center; gap: 11px; min-width: 250px; }
.coin img {
  width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex: none;
  background: var(--m3-surface-2); border: 1px solid var(--m3-outline-var);
}
.coin-name { font-weight: 600; line-height: 1.3; font-size: 13.5px; }
.coin-sub { font-size: 11.5px; color: var(--m3-on-surface-var); margin-top: 2px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700;
  background: var(--m3-surface-2); color: var(--m3-on-surface-var);
}
.tag.warn { background: color-mix(in srgb, var(--m3-warn) 16%, var(--m3-surface-1)); color: var(--m3-warn); }

.gain { color: var(--m3-ok); font-weight: 800; }
.loss { color: var(--m3-on-surface-var); }

.buy {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 999px; text-decoration: none;
  font-size: 12.5px; font-weight: 700;
  background: var(--m3-surface-2); border: 1px solid var(--m3-outline-var);
  color: var(--m3-on-surface);
  transition: transform .12s, box-shadow .15s, background .15s, color .15s;
}
.buy:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
/* A coin worth taking gets the foil. */
tr.hit .buy {
  border-color: transparent; color: #fff; background: var(--fill-grad);
  box-shadow: 0 5px 13px -4px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.32);
}
tr.hit .buy:hover { filter: brightness(1.07); }
.buy svg { width: 12px; height: 12px; }

.empty { padding: 48px 20px; text-align: center; color: var(--m3-on-surface-var); font-size: 14px; font-weight: 700; }
.empty-hint {
  display: block; margin-top: 8px; max-width: 44ch; margin-inline: auto;
  font-size: 12.5px; font-weight: 400; line-height: 1.6; opacity: .85;
}

/* Pager — ten rows to a page. Numbered rather than "load more", so a long
   board can be crossed in one jump instead of a dozen. */
.pager {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 14px 2px 0;
}
.pg-range {
  font-size: 12px; font-weight: 700; color: var(--m3-on-surface-var);
  margin-right: auto;
}
.pg {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--m3-outline-var); background: var(--m3-surface-1);
  color: var(--m3-on-surface); font: 700 12.5px var(--font);
  font-variant-numeric: tabular-nums;
  transition: transform .12s, box-shadow .15s, background .15s, color .15s, border-color .15s;
}
.pg:hover:not(:disabled):not(.is-current) {
  transform: translateY(-1px); box-shadow: var(--shadow-1);
  border-color: color-mix(in srgb, var(--m3-primary) 40%, var(--m3-outline-var));
  color: var(--m3-primary);
}
.pg:disabled { opacity: .4; cursor: default; }
.pg.wide { padding: 0 14px; }
.pg.is-current {
  cursor: default; color: var(--m3-primary);
  background: var(--m3-primary-container);
  border-color: color-mix(in srgb, var(--m3-primary) 30%, var(--m3-outline-var));
}
.pg-gap { color: var(--m3-on-surface-var); padding: 0 2px; font-weight: 700; }

@media (max-width: 860px) {
  .pg-range { width: 100%; margin: 0 0 4px; }
}

/* =========================================================================
   Foot
   ========================================================================= */
details.note {
  margin-top: 16px; border: 1px solid var(--m3-outline-var);
  border-radius: var(--r-md); background: var(--m3-surface-1); padding: 0 18px;
}
details.note > summary {
  cursor: pointer; padding: 13px 0; font-size: 12.5px; font-weight: 700;
  color: var(--m3-on-surface-var);
}
details.note .body { padding: 0 0 14px; font-size: 12.5px; line-height: 1.65; color: var(--m3-on-surface-var); }
details.note dl { margin: 0 0 10px; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
details.note dt { font-weight: 800; color: var(--m3-on-surface); }
details.note dd { margin: 0; }

footer {
  max-width: 1240px; margin: 22px auto 0; padding: 16px 24px 36px;
  border-top: 1px solid var(--m3-outline-var);
  font-size: 12px; color: var(--m3-on-surface-var);
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
footer a { color: var(--m3-primary); text-decoration: none; font-weight: 700; }
footer a:hover { text-decoration: underline; }
footer .right { margin-left: auto; }
.stale { color: var(--m3-warn); font-weight: 800; }

/* =========================================================================
   Small screens
   ========================================================================= */
@media (max-width: 860px) {
  .topbar-inner, .dealbar-inner, .filterbar, main, footer { padding-left: 16px; padding-right: 16px; }
  .ref { margin-left: 0; width: 100%; }
  select.mini { flex: 1; max-width: none; }

  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  .sheet { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
  tbody tr {
    background: var(--m3-surface-1); border: 1px solid var(--m3-outline-var);
    border-radius: var(--r-md); margin-bottom: 10px; box-shadow: var(--shadow-1);
    overflow: hidden;
  }
  tbody tr.hit { border-color: color-mix(in srgb, var(--m3-ok) 45%, var(--m3-outline-var)); }
  tbody tr.hit td:first-child { box-shadow: none; }
  tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    border-bottom: 1px solid var(--m3-outline-var); padding: 9px 14px;
  }
  tbody td::before {
    content: attr(data-label);
    font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
    color: var(--m3-on-surface-var);
  }
  tbody td.left { display: block; }
  tbody td.left::before { content: none; }
  tbody td.act { justify-content: flex-end; }
  tbody td.act::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
