.categories-shell {
  width: min(calc(100% - 2rem), var(--content));
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.categories-topbar {
  /* brand · nav · search · actions — four children, four tracks. The nav needs
     the flexible one for its justify-self: end to reach the right edge. */
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 1.25rem;
}

.categories-nav { justify-self: end; margin-right: 0; }
.categories-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.16rem; text-underline-offset: 0.45rem; }
.category-actions { display: inline-flex; gap: 0.45rem; }
.categories-topbar .search-toggle { justify-self: end; }

.category-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 2.2rem auto 0;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 0.82rem;
}

.category-status strong { color: var(--ink); font-weight: 800; }
.category-status .status-indicator { animation: category-pulse 2.4s ease-in-out infinite; }
.category-status a { color: var(--ink); font-weight: 750; text-decoration: none; }
.category-status a:hover { color: var(--accent-strong); }
.status-indicator, .section-dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); }
.status-indicator { background: var(--up); box-shadow: 0 0 0 0.28rem var(--up-soft); }

.category-hero { margin: 2.5rem 0; }
.section-kicker { margin: 0 0 0.65rem; color: var(--accent-ink); font-size: 0.75rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.category-hero h1 { margin: 0; font-size: 3.2rem; font-weight: 850; letter-spacing: -0.035em; line-height: 1; text-wrap: balance; }
.category-hero > p:last-child { max-width: 44rem; margin: 1.2rem 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.4; }

.section-heading { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1.15rem; }
.section-heading h2 { margin: 0; font-size: 1.08rem; font-weight: 850; letter-spacing: -0.01em; }
.section-heading-spread { align-items: baseline; justify-content: space-between; }
.section-heading-spread > div { display: flex; align-items: center; gap: 0.65rem; }
.section-heading-spread p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.active-category-list { display: grid; gap: 0.75rem; }
.active-category {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface-subtle);
  text-decoration: none;
  transition: border-color 160ms var(--ease), background 160ms var(--ease), transform 160ms var(--ease);
}
.active-category:hover { border-color: var(--accent); background: var(--surface); transform: translateY(-1px); }
.active-category:active { transform: translateY(0); }
.category-icon { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-size: 1.25rem; font-weight: 800; }
.active-category h3 { margin: 0; color: var(--ink); font-size: 1rem; line-height: 1.2; }
.active-category p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.78rem; }
.active-category time { color: var(--muted); font-size: 0.64rem; font-weight: 750; white-space: nowrap; }
.active-empty { margin: 0; padding: 1rem; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 0.82rem; }

.all-categories-section { margin-top: 2.5rem; }
/* Three columns from ~1000px. Two 646px cards holding one 64px row read as
   panels; at 397px they read as what they are — directory entries. */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 0.75rem; }
.category-noscript { color: var(--muted); }
.category-seo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .6rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.category-seo-list a { display: flex; min-height: 2.75rem; align-items: center; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface); color: var(--ink); font-weight: 750; text-decoration: none; }
.category-seo-list a:hover { border-color: var(--accent); color: var(--accent-strong); }
.category-card {
  min-width: 0;
  padding: 1.35rem 1.35rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: var(--surface);
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), background 180ms var(--ease);
}
.category-card:hover { border-color: var(--accent); background: var(--surface-subtle); transform: translateY(-2px); }
.category-card-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.1rem; }
.category-card-head h3 { min-width: 0; margin: 0; color: var(--ink); font-size: 1.2rem; line-height: 1.18; text-wrap: balance; }
/* styles.css sets a decoration COLOUR but never text-decoration-line, so the
   browser underline survives and every child inherits it. */
.category-card-head a { margin-left: auto; color: var(--blue); font-size: 0.74rem; font-weight: 800; white-space: nowrap; text-decoration: none; }
.category-card-head a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.16em; }
.category-rank-row { display: grid; grid-template-columns: 2.25rem 2.75rem minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; min-height: 3.5rem; border-top: 1px solid var(--line); text-decoration: none; }
.category-rank { color: var(--muted); font-size: 0.88rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.category-logo { display: grid; place-items: center; width: 2.45rem; height: 2.45rem; overflow: hidden; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--surface-subtle); color: var(--ink); font-size: 0.68rem; font-weight: 850; }
/* Cut-out logos are drawn for a light page; dark lettering vanishes on a dark
   tile. styles.css forces #fff behind .product-mark img for exactly this. */
.category-logo { position: relative; }
.category-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 0.12rem; background: #fff; }
.category-logo.has-icon .category-initials { visibility: hidden; }
.category-rank-copy { min-width: 0; }
.category-rank-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 0.9rem; text-overflow: ellipsis; white-space: nowrap; }
.category-rank-copy span { display: -webkit-box; overflow: hidden; margin-top: 0.12rem; color: var(--muted); font-size: 0.75rem; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.category-rank-bid { color: var(--accent-strong); font-size: 0.88rem; font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Sized to its content. A 12rem floor wrapped 74px of text in 192px of nothing,
   fifteen times over. */
.category-empty { display: grid; justify-items: start; gap: 0.25rem; padding-top: 0.75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
.category-empty strong { color: var(--ink); font-size: 0.9rem; }
.category-empty a { margin-top: 0.35rem; color: var(--blue); font-weight: 800; text-decoration: none; }
.category-empty a:hover { text-decoration: underline; text-underline-offset: 0.16em; }
.categories-footer { margin-top: 2.5rem; }

@keyframes category-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--up-soft); } 50% { box-shadow: 0 0 0 .28rem transparent; } }

html[data-theme="light"] .categories-topbar .brand { background: transparent; }
html[data-theme="light"] .categories-topbar .brand-emblem-image, html[data-theme="light"] .categories-topbar .brand-wordmark-image { filter: invert(1) hue-rotate(180deg); mix-blend-mode: multiply; }

@media (max-width: 62rem) {
  .categories-topbar { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.7rem; }
  .categories-nav { gap: 0.9rem; }
  .category-hero { margin-top: 3.5rem; }
}

@media (max-width: 48rem) {
  .categories-shell { width: min(calc(100% - 1rem), var(--content)); }
  .categories-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    min-height: 4.6rem;
    padding-block: .35rem .55rem;
  }
  .categories-topbar .brand { width: 3.75rem; height: 3.75rem; }
  .categories-nav { display: flex; justify-self: end; gap: .5rem; margin: 0; font-size: .72rem; }
  .categories-nav a { min-height: 2.75rem; padding-inline: .25rem; }
  .category-actions { justify-self: end; }
  .category-status { margin-top: 1.25rem; font-size: 0.75rem; }
  .active-category time, .category-card-head a { font-size: 0.75rem; }
  .category-status a, .category-card-head a, .category-empty a { display: inline-flex; min-height: 2.75rem; align-items: center; }
  .category-hero { margin: 2rem 0; }
  .category-hero h1 { font-size: 2.7rem; }
  .category-hero > p:last-child { margin-top: 0.9rem; font-size: 1.08rem; }
  .category-grid { grid-template-columns: 1fr; }
  .all-categories-section { margin-top: 2rem; }
  .section-heading-spread { align-items: flex-start; flex-direction: column; gap: 0.35rem; }
}

@media (max-width: 34rem) {
  .categories-topbar { gap: 0.2rem; }
  .categories-topbar .brand { width: 3.35rem; height: 3.35rem; }
  .category-actions { gap: 0.2rem; }
  .category-status { flex-wrap: wrap; justify-content: center; max-width: 100%; text-align: center; }
  /* The icon is 2.7rem; a 2.4rem track overflowed it into the gap at 375px. */
  .active-category { grid-template-columns: 2.75rem minmax(0, 1fr); gap: 0.7rem; }
  .active-category time { grid-column: 2; margin-top: -0.5rem; font-size: 0.75rem; }
  .category-rank-row { grid-template-columns: 1.8rem 2.45rem minmax(0, 1fr) auto; gap: 0.45rem; }
  .category-card { padding-inline: 1rem; }
  /* Boilerplate repeated in fifteen cards; the bold line above already says it. */
  .category-empty span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .category-status .status-indicator { animation: none; }
  .category-card, .active-category { transition: none; }
}

@media (max-width: 22.5rem) {
  .categories-topbar { grid-template-areas: "brand search actions" "nav nav nav"; grid-template-columns: minmax(0, 1fr) auto auto; row-gap: .3rem; }
  .categories-topbar .brand { grid-area: brand; }
  .categories-nav { grid-area: nav; justify-self: stretch; justify-content: flex-end; }
  .categories-topbar .search-toggle { grid-area: search; }
  .category-actions { grid-area: actions; }
}

/* Empty markets fold under one line below the populated grid. */
.category-more { margin-top: .75rem; }
.category-more summary { display: inline-flex; min-height: 2.75rem; align-items: center; gap: .4rem; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .82rem; font-weight: 800; cursor: pointer; list-style: none; }
.category-more summary::-webkit-details-marker { display: none; }
.category-more summary::after { content: "›"; transform: rotate(90deg); transition: transform 160ms var(--ease); }
.category-more[open] summary::after { transform: rotate(-90deg); }
.category-more summary:hover { border-color: var(--accent); }
.category-more > .category-grid { margin-top: .75rem; }

/* ---- Categories, phone review ---- */

/* The whole card opens its market; the head link stretches over the card and
   the rows and the claim line sit above that layer with their own targets. */
.category-card { position: relative; }
.category-card-head a::after { content: ""; position: absolute; inset: 0; }
.category-rankings, .category-claim { position: relative; z-index: 1; }

/* First place has a price in every market that has a leader. */
.category-claim { display: inline-flex; min-height: 2.5rem; align-items: center; margin-top: .6rem; padding: .35rem .8rem; border: 1px solid var(--accent); border-radius: 999px; color: var(--ink); font-size: .76rem; font-weight: 800; text-decoration: none; }
.category-claim:hover { background: var(--accent-fill, var(--accent)); border-color: var(--accent-fill, var(--accent)); color: #fff; }

/* Four markets fit one row on a wide screen instead of three plus an orphan. */
@media (min-width: 64rem) { .category-grid { grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); } }

/* Phone: the first market at ~250px, not ~460px. The status pill repeated the
   nav ("Board") and the count the grid shows; the title comes down a size. */
@media (max-width: 48rem) {
  .category-status { display: none; }
  .category-hero { margin: 1.1rem 0 1rem; }
  .category-hero h1 { font-size: 2.1rem; }
  .category-hero > p:last-child { margin-top: .45rem; font-size: .92rem; }
  .section-heading-spread { margin-bottom: .5rem; }
  .category-card { padding-top: 1rem; }
  .category-card-head { margin-bottom: .7rem; }
  .category-card-head h3 { font-size: 1.05rem; }
}

/* ---- Design pass: the market card takes the board's card grammar ---- */
.category-hero h1 { font-size: 2.6rem; }
.category-hero > p:last-child { font-size: .95rem; }
.all-categories-section { margin-top: 1.75rem; }
.section-heading h2 { font-size: 1rem; }

.category-card { padding: 1rem 1rem .9rem; }
.category-card:hover { transform: none; background: var(--surface); }
.category-card-head { gap: .7rem; margin-bottom: .75rem; }
.category-card-head h3 { font-size: 1.02rem; font-weight: 850; letter-spacing: -.01em; }
/* The icon is a tile like the rank tile on the board, not a pink coin. */
.category-card-head .category-icon { width: 2.25rem; height: 2.25rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface-subtle); color: var(--accent-strong); font-size: 1rem; }
/* The corner link is the whole card's target; it shows as a chevron. */
.category-card-head a { font-size: 0; line-height: 0; color: var(--muted); }
.category-card-head a::before { content: "›"; font-size: 1.25rem; font-weight: 800; line-height: 1; }
.category-card-head a:hover { text-decoration: none; color: var(--ink); }
.category-card:hover .category-card-head a { color: var(--ink); }

.category-rank-row { grid-template-columns: 1.5rem 2.25rem minmax(0, 1fr) auto; gap: .55rem; min-height: 3.1rem; padding: .45rem 0 .55rem; }
.category-rank { font-size: .78rem; }
.category-logo { width: 2.25rem; height: 2.25rem; font-size: .62rem; }
.category-rank-copy strong { font-size: .9rem; font-weight: 800; }
.category-rank-copy span { margin-top: .08rem; font-size: .72rem; -webkit-line-clamp: 1; }
.category-rank-bid { font-size: .92rem; }

/* First place has a price: one full-width control, the price in red. */
.category-claim { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: .6rem; min-height: 2.75rem; margin-top: .5rem; padding: .5rem .85rem; border: 1px solid var(--line-strong); border-radius: .55rem; background: var(--surface-subtle); color: var(--ink); font-size: .82rem; font-weight: 800; text-decoration: none; transition: border-color 160ms var(--ease), background 160ms var(--ease), color 160ms var(--ease); }
.category-claim strong { color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.category-claim-arrow { color: var(--muted); font-weight: 900; }
.category-claim:hover { border-color: var(--accent-fill, var(--accent)); background: var(--accent-fill, var(--accent)); color: #fff; }
.category-claim:hover strong, .category-claim:hover .category-claim-arrow { color: #fff; }

.category-empty { padding-top: .6rem; font-size: .76rem; }
.category-empty strong { font-size: .86rem; }
.category-more summary { font-size: .8rem; }

@media (max-width: 48rem) {
  .category-hero h1 { font-size: 2rem; }
  .category-hero > p:last-child { font-size: .9rem; }
  .category-card { padding: .9rem .9rem .8rem; }
  .category-card-head h3 { font-size: 1rem; }
}

/* ---- After the owner's phone screenshot ---- */

/* Two red numbers 60px apart read as two prices. The leader's total is a
   fact and sits in ink; only the price of first place stays red. */
.category-rank-bid { color: var(--ink); }

/* The heading row on this page matches the board's: title left, time tabs
   right, one row — instead of the tabs dropping under the title. */
.section-heading-spread, .section-heading-spread.section-heading { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: .75rem; text-align: left; }
.section-heading-spread > div { flex: 1 1 auto; justify-content: flex-start; }
.section-heading-spread .time-tabs { flex: 0 0 auto; }

/* The red kicker was the loudest thing above the fold and said what the
   title says. On a phone the title stands on its own. */
@media (max-width: 48rem) {
  .category-hero .section-kicker { display: none; }
  .category-hero { margin-top: .9rem; }
  .category-card-head { margin-bottom: .55rem; padding-bottom: .55rem; }
  .category-rank-row { border-top: 0; padding-top: .2rem; }
}
.category-notice { grid-column: 1 / -1; margin: 0; padding: .85rem 1rem; border: 1px dashed var(--line-strong); border-radius: .65rem; color: var(--muted); font-size: .82rem; line-height: 1.45; }
/* The time toggle is the board's toggle: same height, same side padding,
   same type — one component on two pages, not two pills. */
.section-heading-spread .time-tabs { padding: .12rem; }
.section-heading-spread .time-tabs button { min-width: 0; min-height: 2.25rem; padding: .42rem .7rem; font-size: .72rem; }

/* ---- Desktop, designer pass ---- */
/* ~500px of chrome before the first market: a status pill repeating the
   nav and the count, a red kicker, a 3rem title, a subtitle. On a wide
   screen the pill goes, the title comes down and sits centred like the
   other pages' heroes, and the markets start ~250px down. */
@media (min-width: 48.01rem) {
  .category-status { display: none; }
  .category-hero { max-width: 40rem; margin: 1.5rem auto 1.5rem; text-align: center; }
  .category-hero h1 { font-size: 2.4rem; }
  .category-hero > p:last-child { margin: .5rem auto 0; font-size: .95rem; }
  .all-categories-section { margin-top: 1.25rem; }
}
/* Four cards across leave ~330px each; the leader's name was cut to
   "Rakan Jaya Har…" beside a two-word description. The name wraps to two
   lines and the description steps aside; the card heads line up. */
@media (min-width: 64rem) {
  .category-card-head { min-height: 3.4rem; }
  .category-rank-row { grid-template-columns: 1.5rem 2.25rem minmax(0, 1fr) auto; align-items: center; }
  .category-rank-copy strong { display: -webkit-box; overflow: hidden; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.2; text-overflow: clip; }
  .category-rank-copy span { display: none; }
}
