/* ============================================================================
   cycle.css — Cycle Intelligence Dashboard · design system
   Builds on theme.css tokens (--bg/--panel/--panel2/--text/--muted/--line/
   --warn/--up/--down/--link, dark default + light override). Each cycle owns an
   accent passed as --c; tints derive via color-mix so they adapt to the theme.
   ========================================================================== */

/* CACHE-BUSTER: this file is linked as `cycle.css?v=N` by its pages (the six
   templates/*.html.j2 that build the cycle-family pages + the hand-curated
   site/markets.html). mastermind-x.com is fronted by the TencentEdgeOne CDN,
   which caches CSS aggressively by full URL, so BUMP the ?v= on every one of
   those links whenever you edit this file — otherwise the edge keeps serving
   the stale copy to users. Currently v=4 (v=1 = the unversioned original). */

.cyc-page { --c: var(--link); --rad: 16px; --ease: cubic-bezier(.22,.61,.36,1); }
.cyc-wrap { max-width: 1320px; margin: 0 auto; padding: 0 22px 72px; }

/* The shared menu bar (_site_nav → .site-nav) carries no built-in top gap — it
   relies on the host page giving <body> a top padding. The pages styled by
   cycle.css (cycle, markets, sector_central[_china], sector_cycles[_china]) set
   no body padding, so without this the menu jams against the very top of the
   viewport — the recurring "menu has no padding" bug. Owning the gap here fixes
   every cycle.css page at once; the floor is enforced by scripts/check_nav_gap.py.
   These pages carry no inline <body> style of their own, so this rule is also
   their base canvas: pull background/text from the theme tokens (dark default,
   light override) or <body> falls back to transparent + black text — unreadable
   in dark mode. */
body { margin: 0; padding-top: 24px; background: var(--bg); color: var(--text); }

/* nav layout (desktop horizontal; theme.js collapses it under 700px) */
.site-nav .nav-links { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.site-nav .nav-link { font-size: 13.5px; color: var(--muted); text-decoration: none; padding: 6px 11px; border-radius: 9px; transition: color .16s, background .16s; }
.site-nav .nav-link:hover { color: var(--text); background: var(--panel); }
.site-nav .nav-link.active { color: var(--text); background: var(--panel); }
.nav-ctrls .theme-btn, .nav-ctrls .lang-btn { font-size: 12.5px; padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }

/* ---- header -------------------------------------------------------------- */
.cyc-hd { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; padding: 26px 2px 20px; }
.cyc-hd .ht { flex: 1 1 auto; min-width: 240px; }
.cyc-kicker { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; gap: 9px; }
.cyc-kicker .hb { width: 7px; height: 7px; border-radius: 50%; background: var(--up);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); animation: cyc-hb 2.6s ease-in-out infinite; }
@keyframes cyc-hb { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.cyc-title { font-size: clamp(30px, 4.4vw, 46px); font-weight: 800; letter-spacing: -.025em; margin: 8px 0 6px;
  line-height: 1.02; background: linear-gradient(92deg, var(--text), color-mix(in srgb, var(--text) 55%, var(--link)));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cyc-sub { font-size: 15px; color: var(--muted); max-width: 64ch; line-height: 1.5; }
.cyc-ctrls { display: flex; align-items: center; gap: 8px; }
.cyc-asof { font-size: 12px; color: var(--muted); padding: 6px 11px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--panel); font-variant-numeric: tabular-nums; }

/* ---- stage: hero ON TOP, detail as a full-width underbar BELOW ------------
   The chart gets the full width; the detail panel is a fixed in-flow underbar
   directly beneath it (its content flows into columns on desktop). On mobile the
   underbar becomes a draggable bottom sheet (see the responsive block). */
.cyc-stage { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }

.cyc-hero { background: var(--panel); border: 1px solid var(--line); border-radius: var(--rad);
  padding: 16px 16px 8px; position: relative; overflow: hidden;
  box-shadow: var(--card-shadow); }
.cyc-hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 120px; pointer-events: none;
  background: radial-gradient(120% 90% at 50% -30%, color-mix(in srgb, var(--link) 9%, transparent), transparent 70%); }
.cyc-hero-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; position: relative; }
.cyc-hero-hd h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0; }
.cyc-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.cyc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cyc-legend .ls { width: 18px; height: 0; border-top: 2px solid currentColor; color: var(--text); opacity: .8; }
.cyc-legend .lp { width: 18px; height: 0; border-top: 2px dashed currentColor; color: var(--text); opacity: .7; }
.cyc-legend .lc { width: 14px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--text) 16%, transparent); }

/* hero tools row (legend + zoom controls), wraps on small screens */
.cyc-hero-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }

/* zoom controls — presets + reset (reset appears only when zoomed) */
.cyc-zoom { display: inline-flex; align-items: center; gap: 4px; }
.cyc-zhint { font-size: 10.5px; color: var(--muted); opacity: .75; margin-right: 3px; letter-spacing: .02em; }
.cyc-zbtn { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 7px; padding: 4px 9px; cursor: pointer; transition: color .16s, border-color .16s, transform .1s; }
.cyc-zbtn:hover { color: var(--text); border-color: color-mix(in srgb, var(--link) 50%, var(--line)); }
.cyc-zbtn:active { transform: translateY(1px); }
.cyc-zreset { display: none; color: var(--link); border-color: color-mix(in srgb, var(--link) 40%, var(--line)); }
.cyc-zoom.zoomed .cyc-zreset { display: inline-flex; }

/* group filter — declutter the overlay by asset family */
.cyc-groups { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 2px 2px 11px; }
.cyc-glabel { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); opacity: .8; margin-right: 2px; }
.cyc-gchip { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; cursor: pointer; transition: all .18s var(--ease); display: inline-flex; align-items: center; gap: 5px; }
.cyc-gchip i { font-style: normal; font-size: 10px; font-weight: 700; opacity: .6; }
.cyc-gchip:hover { color: var(--text); }
.cyc-gchip.on { color: var(--text); background: var(--panel); border-color: color-mix(in srgb, var(--ph, var(--text)) 45%, var(--line)); }
.cyc-gchip:not(.on) { opacity: .5; }
.cyc-gchip .gdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ph, var(--muted)); flex: none; }
.cyc-gchip:not(.on) .gdot { background: var(--muted); }

/* "Select all" reset — pushed to the right; glows when a phase filter is active */
.cyc-gall { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; cursor: pointer; transition: color .2s, border-color .2s, background .2s, box-shadow .2s, transform .12s; }
.cyc-gall .ga-dots { display: inline-flex; gap: 2px; }
.cyc-gall .ga-dots i { width: 5px; height: 5px; border-radius: 50%; opacity: .85; transition: transform .2s var(--ease); }
.cyc-gall:hover { color: var(--text); transform: translateY(-1px); }
.cyc-gall:hover .ga-dots i { transform: scale(1.18); }
.cyc-gall:active { transform: translateY(0); }
.cyc-gall.active { color: var(--link); background: color-mix(in srgb, var(--link) 12%, var(--panel2));
  border-color: color-mix(in srgb, var(--link) 52%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--link) 22%, transparent), 0 4px 14px color-mix(in srgb, var(--link) 18%, transparent); }
.cyc-gall:not(.active) .ga-dots i:nth-child(n) { filter: saturate(.55); }

/* phase-filtered out: DIM in place (never display:none — that collapses the
   layout and shifts the chart). Chips dim but stay clickable (clicking still
   focuses, which re-reveals that line). */
.cyc-chip.gdim { opacity: .28; }
.cyc-chip.gdim:hover { opacity: .7; }

/* hover x-axis date pill (month/year) */
.mmc-xlabel { pointer-events: none; }
.mmc-xlabel rect { filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }

/* brush rectangle (shift+drag zoom-select) */
.mmc-brush { pointer-events: none; }

/* chip row */
.cyc-chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: thin; position: relative;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.cyc-chips::-webkit-scrollbar { height: 6px; }
.cyc-chips::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.cyc-chip { --c: var(--link); flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 9px; cursor: pointer;
  transition: all .22s var(--ease); white-space: nowrap; scroll-snap-align: start; }
.cyc-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 50%, transparent); transition: box-shadow .22s ease; }
.cyc-chip:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); transform: translateY(-1px); }
.cyc-chip.on { color: #fff; background: color-mix(in srgb, var(--c) 88%, #000 6%);
  border-color: var(--c); box-shadow: 0 4px 16px color-mix(in srgb, var(--c) 34%, transparent); }
html[data-theme="light"] .cyc-chip.on { color: #fff; }
.cyc-chip.on .dot { background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, #fff 30%, transparent); }
.cyc-chip.off { opacity: .5; }
.cyc-chip.off:hover { opacity: 1; }

#cyc-chart { width: 100%; height: 452px; }

/* ---- chart engine styling (mm_charts) ----------------------------------- */
.mmc-series { transition: opacity .4s var(--ease); }
.mmc-series .mmc-hist, .mmc-series .mmc-proj { stroke-opacity: .68; transition: stroke-width .25s ease, stroke-opacity .3s ease; }
.mmc-series.is-dim { opacity: .12; }
/* when nothing is focused, soften lines so the now-dots + TODAY column lead */
.mmc-series.is-focus .mmc-hist, .mmc-series.is-focus .mmc-proj { stroke-width: 3.2px; stroke-opacity: 1; }
.mmc-series .mmc-mk-peak, .mmc-series .mmc-mk-trough { opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.mmc-series.is-focus .mmc-mk-peak, .mmc-series.is-focus .mmc-mk-trough { opacity: .92; }
.mmc-has-focus .mmc-cone { opacity: .05; }
.mmc-series.is-focus .mmc-cone { opacity: .18 !important; }
.mmc-now-ring { animation: cyc-ring 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes cyc-ring { 0%,100% { opacity: .5 } 50% { opacity: .12 } }
.mmc-band-lab { text-transform: uppercase; letter-spacing: .1em; font-weight: 600; opacity: .7; }

.mmc-tip { background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; min-width: 130px;
  box-shadow: var(--popover-shadow); font-size: 12px; }
.mmc-tip-h { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px; color: var(--text); }
.mmc-tip-h .dot { width: 9px; height: 9px; border-radius: 50%; }
.mmc-tip-yr { color: var(--muted); font-size: 11px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.mmc-tip-z { color: var(--text); font-size: 12px; margin-top: 4px; }
.mmc-tip-ph { color: var(--muted); font-size: 11px; margin-top: 3px; }

/* ---- detail panel (underbar desktop / sheet mobile) --------------------- */
.cyc-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--rad);
  position: static; box-shadow: var(--card-shadow); }
.cyc-handle { display: none; }
.cyc-panels { position: relative; padding: 18px; }
.cyc-panel { position: absolute; inset: 18px; opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .34s var(--ease), transform .34s var(--ease); pointer-events: none; }
.cyc-panel.show { position: relative; inset: auto; opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.cyc-grp { margin-bottom: 18px; }
.cyc-grp:last-child { margin-bottom: 0; }
.cyc-grp-full .cyc-lbl, .cyc-grp-3 .cyc-lbl { margin-bottom: 9px; }

.cyc-lbl { font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.cyc-lbl.mt { margin-top: 22px; }

/* default panel — regime + map + how-to */
.rg-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 8px; }
.rg-label { font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.rg-sub { font-size: 12px; color: var(--warn); font-weight: 600; }
.rg-headline { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 14px; }
.rg-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.rg-stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; }
.rg-k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rg-v { font-size: 16px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin: 1px 0; }
.rg-n { font-size: 10px; color: var(--muted); line-height: 1.25; }
.rg-tilt { font-size: 12.5px; line-height: 1.55; color: var(--muted); border-left: 2px solid color-mix(in srgb, var(--warn) 60%, transparent);
  padding-left: 11px; margin: 4px 0 0; }

.xc-map { display: flex; flex-direction: column; gap: 11px; }
.xc-row .xc-rh { font-size: 12px; font-weight: 700; color: var(--text); display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.xc-row .xc-rh span { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.xc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-chip { --c: var(--link); display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px 4px 8px; cursor: pointer; transition: all .18s var(--ease); }
.mini-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.mini-chip:hover { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--panel2)); transform: translateY(-1px); }
/* large fields (thematic baskets): clamp the where-they-stand map behind a "see more" */
.xc-map-clamp { max-height: 220px; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent); mask-image: linear-gradient(180deg, #000 62%, transparent); }
.xc-map-clamp.xc-map-open { max-height: none; -webkit-mask-image: none; mask-image: none; }
.xc-more { display: inline-flex; align-items: center; gap: 5px; margin-top: 9px; padding: 5px 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--link); font-variant-numeric: tabular-nums;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: all .18s var(--ease); }
.xc-more:hover { border-color: var(--link); background: color-mix(in srgb, var(--link) 12%, var(--panel2)); }

.cyc-how { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.cyc-how li { font-size: 12.5px; line-height: 1.5; color: var(--muted); padding-left: 18px; position: relative; }
.cyc-how li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 7px; height: 7px; border-radius: 2px;
  background: color-mix(in srgb, var(--link) 70%, transparent); }
.cyc-how b { color: var(--text); font-weight: 700; }

/* focus panel */
.cyc-back { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; margin-bottom: 14px;
  transition: all .18s ease; }
.cyc-back:hover { color: var(--text); border-color: var(--line2, var(--muted)); transform: translateX(-2px); }
.cyc-fhead { --c: var(--link); border-left: 3px solid var(--c); padding-left: 12px; margin-bottom: 13px; }
.cyc-ftitle { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text); line-height: 1.1; }
.cyc-fsub { font-size: 12px; color: var(--muted); margin: 2px 0 9px; }
.cyc-fchips { display: flex; flex-wrap: wrap; gap: 7px; }
.cyc-pchip { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  color: var(--ph, var(--muted)); background: color-mix(in srgb, var(--ph, var(--muted)) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--ph, var(--muted)) 40%, transparent); }
.cyc-tchip { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.cyc-tchip.t-up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); border-color: color-mix(in srgb, var(--up) 38%, transparent); }
.cyc-tchip.t-down { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); border-color: color-mix(in srgb, var(--down) 38%, transparent); }
.cyc-tchip.t-mix { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 38%, transparent); }
.cyc-tchip.t-na { color: var(--muted); }
.cyc-arche { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin: 0 0 14px; }
.cyc-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 11px; overflow: hidden; margin-bottom: 14px; }
.cyc-facts .f { background: var(--panel); padding: 9px 11px; }
.cyc-facts .fk { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cyc-facts .fv { font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 2px; }
.cyc-read, .cyc-fals, .cyc-drivers { margin-bottom: 13px; }
.cyc-read p, .cyc-fals p { font-size: 13px; line-height: 1.58; color: var(--text); margin: 0; }
.cyc-fals { background: color-mix(in srgb, var(--down) 8%, transparent); border: 1px solid color-mix(in srgb, var(--down) 26%, transparent);
  border-radius: 11px; padding: 11px 13px; }
.cyc-fals .cyc-lbl { color: color-mix(in srgb, var(--down) 80%, var(--muted)); }
.cyc-fals p { color: var(--muted); font-size: 12.5px; }
.cyc-drivers ul { margin: 0; padding-left: 17px; }
.cyc-drivers li { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-bottom: 3px; }
.cyc-regnote { font-size: 12px; line-height: 1.5; color: var(--muted); font-style: italic;
  border-top: 1px solid var(--line); padding-top: 11px; }

/* ---- scorecard grid ------------------------------------------------------ */
.cyc-cards-hd { display: flex; align-items: baseline; gap: 10px; margin: 30px 2px 14px; }
.cyc-cards-hd h2 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0; }
.cyc-cards-hd .sub { font-size: 12px; color: var(--muted); }
.cyc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.cyc-card { --c: var(--link); background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 15px 12px; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .26s var(--ease), box-shadow .26s var(--ease), border-color .26s var(--ease), opacity .26s var(--ease); }
.cyc-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); opacity: .85; }
.cyc-card::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--c) 12%, transparent), transparent 55%); opacity: 0; transition: opacity .3s ease; }
.cyc-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 45%, var(--line));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--c) 18%, transparent); }
.cyc-card.lit { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 14px 38px color-mix(in srgb, var(--c) 26%, transparent); transform: translateY(-2px); }
.cyc-card.lit::after { opacity: 1; }
.cyc-card.dim { opacity: .52; }
.cyc-card.dim:hover { opacity: 1; }
/* phase-filtered-out cards: dim + shuffled below (via inline `order`), not removed */
.cyc-card.gdim { opacity: .4; }
.cyc-card.gdim:hover { opacity: .85; }
.cyc-card.lit { opacity: 1; }   /* focus always wins over a filter-dim */
.cc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.cc-id { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.cc-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); margin-top: 3px; flex: none;
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent); }
.cc-nm { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.15; letter-spacing: -.01em; }
.cc-px { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.25; }
.cc-phase { --ph: var(--muted); flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 3px 8px; border-radius: 999px;
  color: var(--ph); background: color-mix(in srgb, var(--ph) 15%, transparent); border: 1px solid color-mix(in srgb, var(--ph) 34%, transparent); white-space: nowrap; }
.cc-spark { height: 56px; margin: 9px -4px 8px; }
.cc-meta { display: flex; flex-direction: column; gap: 8px; }
.cc-leg-bar { height: 5px; border-radius: 99px; background: var(--panel2); overflow: hidden; border: 1px solid var(--line); }
.cc-leg-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c)); transition: width .6s var(--ease); }
.cc-leg-lab { font-size: 10.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.cc-next { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text); flex-wrap: wrap; }
.cc-arrow { color: var(--c); font-size: 11px; }
.cc-tilt { margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); }
.cc-tilt.t-up { color: var(--up); border-color: color-mix(in srgb, var(--up) 36%, transparent); }
.cc-tilt.t-down { color: var(--down); border-color: color-mix(in srgb, var(--down) 36%, transparent); }
.cc-tilt.t-mix { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 36%, transparent); }
.cc-tilt.t-na { color: var(--muted); }

/* ---- desktop: full-width chart + the detail underbar flows into columns --- */
@media (min-width: 881px) {
  #cyc-chart { height: 484px; }
  .cyc-detail { overflow: hidden; }
  .cyc-panel.show { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 30px; row-gap: 2px; align-items: start; }
  .cyc-grp { margin-bottom: 0; }
  .cyc-grp-full { grid-column: span 12; margin-bottom: 8px; }
  .cyc-grp-full .cyc-arche, .cyc-grp-full .rg-headline { max-width: 92ch; }
  .cyc-grp-3 { grid-column: span 4; }
  /* hairline dividers between the three content columns */
  .cyc-grp-3 + .cyc-grp-3 { position: relative; }
  .cyc-grp-3 + .cyc-grp-3::before { content: ""; position: absolute; left: -15px; top: 1px; bottom: 1px;
    width: 1px; background: var(--line); }
  .cyc-back { margin-bottom: 10px; }
  .cyc-fhead { display: inline-block; margin-right: 18px; }
}

/* ---- responsive: mobile = full-width hero + bottom sheet ----------------- */
@media (max-width: 880px) {
  .cyc-wrap { padding: 0 14px 120px; }
  .cyc-stage { grid-template-columns: 1fr; gap: 14px; }
  #cyc-chart { height: 340px; }
  /* half-screen sheet so the cycle chart stays visible above it */
  .cyc-detail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 40;
    border-radius: 18px 18px 0 0; border-bottom: none; transform: translateY(calc(100% - 126px));
    transition: transform .4s var(--ease); height: 52vh; max-height: 52vh; display: flex; flex-direction: column;
    box-shadow: 0 -12px 40px rgba(0,0,0,.34); }
  .cyc-detail.expanded { transform: translateY(0); }
  .cyc-handle { display: flex; align-items: center; justify-content: center; padding: 10px 0 6px; cursor: grab; flex: none; touch-action: none; }
  .cyc-handle::before { content: ""; width: 40px; height: 4px; border-radius: 99px; background: var(--line2, var(--muted)); opacity: .6; }
  .cyc-panels { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; padding-top: 4px; }
  .cyc-panel { position: relative; inset: auto; }
  .cyc-panel:not(.show) { display: none; }
  .rg-stats { grid-template-columns: repeat(3, 1fr); }
  .cyc-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .cyc-card { padding: 12px 12px 10px; }
  .cc-spark { height: 46px; }
}
@media (max-width: 460px) {
  .cyc-cards { grid-template-columns: 1fr 1fr; }
  .cc-px { display: none; }
}

/* ---- China mobile: a true hidden-at-rest, multi-detent bottom sheet --------
   Replaces the permanent 126px peek (which floated over the scorecards) with a sheet
   that is GONE at rest and rises to a half (nonmodal, chart still visible) or full
   (modal, scrim) detent only when a sector is focused. translateY-only → compositor
   cheap. All .sc-china-scoped so the US mobile page keeps its peek sheet. */
@media (max-width: 880px) {
  .sc-china .cyc-detail { top: auto; bottom: 0; height: 92vh; max-height: 92vh; z-index: 60;
    transform: translateY(100%); transition: transform .42s var(--ease); box-shadow: 0 -14px 44px rgba(0,0,0,.4); }
  .sc-china .cyc-detail.sc-sheet-half { transform: translateY(46vh); }
  .sc-china .cyc-detail.sc-sheet-full { transform: translateY(0); }
  .sc-china .cyc-detail.sc-dragging { transition: none; will-change: transform; }
  .sc-china .cyc-panels { overscroll-behavior: contain; }
  /* bigger grab zone + a visible close affordance */
  .sc-china .cyc-handle { min-height: 22px; padding: 13px 0 9px; position: relative; touch-action: none; }
  .sc-china .sc-sheet-x { position: absolute; top: 7px; right: 12px; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center; border: 0; cursor: pointer;
    background: var(--panel2); color: var(--muted); border-radius: 50%; font-size: 17px; line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.25); z-index: 2; -webkit-tap-highlight-color: transparent; }
  .sc-china .sc-sheet-x:active { transform: scale(.92); }
  /* scrim behind the FULL (modal) detent only — half/hidden stay browseable */
  .sc-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.46); opacity: 0; pointer-events: none;
    transition: opacity .32s var(--ease); z-index: 55; }
}

/* ---- China mobile: declutter the preamble + control stack, 44px touch targets ----
   Everything .sc-china-scoped (incl. the nav-brand hide) so desktop and the shared US
   sector / standalone Cycle pages are untouched. NOTE: a position:sticky toolbar is
   intentionally NOT used — .cyc-hero is overflow:hidden, inside which sticky cannot
   stick; we compact the stack instead. */
@media (max-width: 880px) {
  /* slimmer hero: smaller gradient title + a clamped 4-line subtitle (the full
     methodology lives in the collapsible EXPERIMENTAL note just below). */
  .sc-china .cyc-title { font-size: clamp(23px, 7vw, 31px); margin: 6px 0 6px; }
  .sc-china .cyc-sub { font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 4;
    -webkit-box-orient: vertical; overflow: hidden; }
  .sc-china .cyc-hd { padding: 16px 2px 12px; }

  /* EXPERIMENTAL provenance → a tappable accordion (collapsed by default; JS adds the
     .sc-prov-head wrapper + caret and toggles .sc-prov-open). */
  .sc-china .sc-provenance.sc-prov-collapsible { flex-direction: column; gap: 0; padding: 0; align-items: stretch; }
  .sc-china .sc-prov-head { display: flex; align-items: center; gap: 9px; padding: 12px 13px; cursor: pointer;
    min-height: 44px; box-sizing: border-box; }
  .sc-china .sc-prov-caret { margin-left: auto; color: var(--muted); font-size: 12px;
    transition: transform .24s var(--ease); }
  .sc-china .sc-prov-collapsible.sc-prov-open .sc-prov-caret { transform: rotate(180deg); }
  .sc-china .sc-prov-collapsible .sc-prov-text { max-height: 0; overflow: hidden; margin: 0; padding: 0 13px;
    transition: max-height .34s var(--ease), padding .24s var(--ease); }
  .sc-china .sc-prov-collapsible.sc-prov-open .sc-prov-text { max-height: 1400px; padding: 0 13px 13px; }

  /* compact control stack: cards are the legend, so drop it; phase filter to ONE
     horizontally-scrollable row (was 3 wrapped rows ≈110px). */
  .sc-china .cyc-legend { display: none; }
  .sc-china .cyc-hero-tools { gap: 8px 10px; }
  .sc-china .cyc-groups { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding: 2px 2px 9px; }
  .sc-china .cyc-groups::-webkit-scrollbar { display: none; }
  .sc-china .cyc-glabel { display: none; }
  .sc-china .cyc-gchip, .sc-china .cyc-gall { flex: 0 0 auto; }
  .sc-china .cyc-gall { margin-left: 6px; }

  /* ≥44px-ish touch targets (Apple HIG 44pt / Material 48dp) — grow the hit box, keep
     the pill look. */
  .sc-china .sc-mbtn, .sc-china .sc-sbtn { min-height: 40px; display: inline-flex; align-items: center; }
  .sc-china .cyc-zbtn { min-height: 38px; display: inline-flex; align-items: center; }
  .sc-china .cyc-gchip { min-height: 40px; }
  .sc-china .cyc-chip { min-height: 42px; }
  .sc-china .sc-tab { min-height: 44px; }
  .sc-china .sc-chip-all, .sc-china .sc-bask-all, .sc-china .sc-bask-toggle { min-height: 42px; }
}
@media (max-width: 560px) {
  /* keep the nav on a single row — theme.js already collapses the links to a hamburger
     under 700px, so the brand wordmark is the only thing forcing a 2nd row. */
  .sc-china .nav-brand { display: none; }
}

/* ---- China mobile: Series picker — curate exactly which lines are on the chart ----
   The 31-chip horizontal rail is replaced by a single "Series (n)" trigger that opens a
   searchable, phase-grouped multi-select bottom sheet. All .sc-china / mobile-injected. */
@media (max-width: 880px) {
  .sc-china #sc-chips .cyc-chip { display: none; }   /* rail chips → the picker replaces them */
  .sc-china .sc-series-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
    min-height: 42px; white-space: nowrap; cursor: pointer; font-size: 12.5px; font-weight: 700;
    color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
  .sc-china .sc-series-btn .sc-series-n { font-size: 11px; font-weight: 800; color: var(--link);
    background: color-mix(in srgb, var(--link) 14%, transparent); border-radius: 999px; padding: 1px 8px; min-width: 18px; text-align: center; }
  .sc-china .sc-series-btn .sc-series-car { color: var(--muted); font-size: 11px; }
}
/* the picker overlay is created (mobile only) on the body — a bottom-sheet modal */
.sc-series-ov { position: fixed; inset: 0; z-index: 70; display: none; }
.sc-series-ov.open { display: block; }
.sc-series-ov .sc-series-back { position: absolute; inset: 0; background: rgba(0,0,0,.5); opacity: 0;
  transition: opacity .3s var(--ease); }
.sc-series-ov.open .sc-series-back { opacity: 1; }
.sc-series-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0;
  box-shadow: 0 -14px 44px rgba(0,0,0,.42); transform: translateY(100%); transition: transform .4s var(--ease); }
.sc-series-ov.open .sc-series-panel { transform: translateY(0); }
.sc-series-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.sc-series-ttl { font-size: 15px; font-weight: 800; color: var(--text); }
.sc-series-done { margin-left: auto; min-height: 40px; padding: 0 18px; border: 0; cursor: pointer; border-radius: 999px;
  font-size: 13px; font-weight: 750; color: #fff; background: var(--link); }
.sc-series-tools { display: flex; align-items: center; gap: 8px; padding: 4px 16px 10px; }
.sc-series-search { flex: 1 1 auto; min-width: 0; min-height: 42px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 14px; }
.sc-series-act { min-height: 42px; padding: 0 13px; border: 1px solid var(--line); background: var(--panel2); color: var(--link);
  border-radius: 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.sc-series-list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 2px 8px 22px; }
.sc-series-grp { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 13px 8px 5px; }
.sc-series-row { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 48px; padding: 6px 8px; cursor: pointer;
  border-radius: 12px; background: none; border: 0; text-align: left; }
.sc-series-row:active { background: var(--panel2); }
.sc-series-row .sc-ck { width: 22px; height: 22px; flex: none; border-radius: 7px; border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; opacity: 0; transition: opacity .12s; }
.sc-series-row.on .sc-ck { background: var(--link); border-color: var(--link); opacity: 1; }
.sc-series-row .sc-sdot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c, var(--muted)); }
.sc-series-row .sc-nm { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.sc-series-row .sc-rs { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.sc-series-row.sc-hidden { display: none; }

/* ---- China mobile: full-screen chart mode ---------------------------------
   A ⤢ button expands the chart to fill the viewport — where there is no page to
   scroll, so the chart reverts to rich one-finger panning (touch-action:none, set
   in JS). ✕ exits. .sc-china + mobile-injected button only. */
@media (max-width: 880px) {
  .sc-china .sc-chart-fs-btn { position: absolute; top: 8px; right: 8px; z-index: 5; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center; cursor: pointer; border: 1px solid var(--line);
    border-radius: 11px; color: var(--text); font-size: 16px; line-height: 1; -webkit-tap-highlight-color: transparent;
    background: color-mix(in srgb, var(--panel) 80%, transparent); backdrop-filter: blur(6px); }
  .sc-china .sc-chart-fs-btn:active { transform: scale(.94); }
  .sc-china .sc-chartwrap.sc-fs { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex;
    padding: env(safe-area-inset-top) 4px calc(4px + env(safe-area-inset-bottom)); }
  .sc-china .sc-chartwrap.sc-fs #sc-chart { width: 100%; height: 100%; }
  .sc-china .sc-chartwrap.sc-fs .sc-chart-fs-btn { top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 6; }
}

@media (prefers-reduced-motion: reduce) {
  .cyc-page *, .mmc-series, .cyc-card, .cyc-panel { transition: none !important; animation: none !important; }
}

/* ============================================================================
   W3.2 — engine-backed two-tier (MEASURED / FRAME) rendering
   ----------------------------------------------------------------------------
   Tone-NEUTRAL tier colours (ruling A3): MEASURED/FRAME are evidence classes,
   NOT up/down signals — they must not read as bullish/bearish, so they use
   --text / --muted neutrals, never --up/--down (which the zh flip would recolour).
   ========================================================================== */

/* staleness banner (W0.1 — analyst notes only; engine reads are live) */
.stale-banner { font-size: 11.5px; font-weight: 600; padding: 7px 12px; border-radius: 9px; margin: 2px 0 8px; line-height: 1.4; }
.stale-banner.stale-amber { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent); }
.stale-banner.stale-red { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); }

/* tier chip + hover "how computed" (the ONLY user-facing tier words) */
.cc-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.cyc-tier { position: relative; font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap; cursor: help; }
.cyc-tier.tier-measured { color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); border: 1px solid color-mix(in srgb, var(--text) 30%, transparent); }
.cyc-tier.tier-frame { color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); }
/* stale-tape chip (per-band degrade): amber, same hover-hint mechanics as the tier chips */
.cyc-tier.tier-stale { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
/* the hover "how computed" micro-line — proxy/basis/epoch/fitness detail */
.cyc-tier-h { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; width: max-content; max-width: 230px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0; text-transform: none; text-align: left; line-height: 1.35;
  color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  box-shadow: 0 8px 22px rgba(0,0,0,.28); pointer-events: none; }
.cyc-tier:hover .cyc-tier-h, .cyc-tier:focus .cyc-tier-h { display: block; }

/* tolerance delta note (hand-opinion vs engine position) */
.cc-tol { font-size: 10px; color: var(--muted); margin-top: 8px; font-variant-numeric: tabular-nums;
  border-top: 1px dashed var(--line); padding-top: 7px; }
.cc-tol.loud { color: var(--warn); }
.cc-elapsed { font-size: 10.5px; color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); border-radius: 8px; padding: 5px 8px; margin: 4px 0 8px; line-height: 1.35; }

/* FRAME scorecard: curated timeline + A8 text + monitors + reserved tripwire slot */
.cyc-card.card-frame { border-style: dashed; }
.cyc-card.card-frame::before { opacity: .4; height: 2px; }
.cc-timeline { height: 44px; margin: 10px -4px 6px; }
.cc-frame-a8 { font-size: 11px; line-height: 1.5; color: var(--muted); }
.cc-frame-a8 b { color: var(--text); font-weight: 700; }
.cc-frame-note { color: var(--muted); opacity: .8; }
.cc-tripwire:empty { display: none; }                    /* W3.3 fills this */
.cc-monitors { font-size: 9.5px; color: var(--muted); margin-top: 8px; letter-spacing: .01em; border-top: 1px dashed var(--line); padding-top: 6px; }
.cc-monitors span { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .8; }

/* FRAME / MEASURED chip in the toggle row */
.cyc-chip.chip-frame { border-style: dashed; opacity: .82; }

/* detail-panel additions */
.cyc-howline { font-size: 10.5px; line-height: 1.5; color: var(--muted); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-bottom: 14px; }
.cyc-facts .fv .fv-sub { font-size: 10px; font-weight: 500; color: var(--muted); }
.cyc-opinion-badge { font-size: 8.5px; font-weight: 800; letter-spacing: .09em; padding: 1px 6px; border-radius: 999px;
  color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); border: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent);
  vertical-align: middle; cursor: help; }
.cyc-asof-mini { font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: 0; text-transform: none; }
.cyc-tol-line { font-size: 11px; line-height: 1.5; color: var(--muted); margin-top: 9px; border-top: 1px dashed var(--line); padding-top: 8px; font-variant-numeric: tabular-nums; }
.cyc-tol-line.loud { color: var(--warn); }
.cyc-dual-hint { font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; vertical-align: middle;
  padding: 2px 6px; border-radius: 999px; color: var(--muted); background: color-mix(in srgb, var(--muted) 10%, transparent); border: 1px solid var(--line); }

/* secular strip on DUAL focus panels (compact frame timeline beneath the measured facts) */
.cyc-secular { border-top: 1px dashed var(--line); padding-top: 14px; }
.cyc-secular .cyc-lbl { display: flex; align-items: center; gap: 8px; }
.cyc-secular .cyc-tier { cursor: default; }
.cyc-secular-strip { height: 42px; margin: 6px -4px 6px; }
.cyc-secular-txt { font-size: 11.5px; line-height: 1.5; color: var(--muted); margin: 4px 0 0; }

/* the focus-title tier badge sits inline — keep it from crowding the title */
.cyc-ftitle .cyc-tier { font-size: 9px; vertical-align: middle; margin-left: 4px; cursor: help; }

/* scorecard sparks + FRAME timelines are SINGLE-series (uncluttered), so their engine turn
   markers should always show — override the hero's "focus-only" peak/trough hiding. */
.cc-spark .mmc-series .mmc-mk-peak, .cc-spark .mmc-series .mmc-mk-trough,
.cc-timeline .mmc-series .mmc-mk-peak, .cc-timeline .mmc-series .mmc-mk-trough,
.cyc-secular-strip .mmc-series .mmc-mk-peak, .cyc-secular-strip .mmc-series .mmc-mk-trough { opacity: .9; }

/* ── W3.3: Falsifier tripwire strip ─────────────────────────────────────── */
/* State colors via severity tokens (NOT up/down — zh flip bypassed).
   FIRED = red alert; ARMED = green-neutral; MANUAL = amber; MISSING/EXPIRED = grey */

.tw-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  font-size: 10.5px; line-height: 1.4; margin-top: 10px;
  border-top: 1px solid var(--line); padding-top: 8px;
}
.tw-summary { font-weight: 700; letter-spacing: .03em; color: var(--muted); }
.tw-summary-fired { color: var(--down); }   /* down = red/alert — no zh flip (state color) */
.tw-item {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; cursor: help;
}
.tw-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}

/* ARMED: green-neutral */
.tw-armed {
  background: color-mix(in srgb, var(--up) 10%, transparent);
  border-color: color-mix(in srgb, var(--up) 25%, transparent);
  color: color-mix(in srgb, var(--up) 80%, var(--text));
}
.tw-dot-armed { background: var(--up); }

/* FIRED: red alert */
.tw-fired {
  background: color-mix(in srgb, var(--down) 12%, transparent);
  border-color: color-mix(in srgb, var(--down) 35%, transparent);
  color: color-mix(in srgb, var(--down) 80%, var(--text));
}
.tw-dot-fired { background: var(--down); }

/* MANUAL: amber */
.tw-manual {
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-color: color-mix(in srgb, var(--warn) 25%, transparent);
  color: color-mix(in srgb, var(--warn) 80%, var(--text));
}
.tw-dot-manual { background: var(--warn); }

/* DATA_MISSING + EXPIRED: grey */
.tw-data-missing, .tw-expired {
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  border-color: color-mix(in srgb, var(--muted) 20%, transparent);
  color: var(--muted);
}
.tw-dot-missing, .tw-dot-expired { background: var(--muted); }

/* FIRED banner above the card */
.cc-fired-banner {
  font-size: 11px; line-height: 1.5; font-weight: 600;
  color: var(--down); background: color-mix(in srgb, var(--down) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--down) 25%, transparent);
  border-radius: 8px; padding: 6px 10px; margin-bottom: 8px;
}

/* focus panel tripwire block */
.tw-focus-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.tw-focus-row { font-size: 11.5px; line-height: 1.5; }
.tw-focus-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tw-claim { font-weight: 500; color: var(--text); }
.tw-dir { font-size: 10px; color: var(--muted); }
.tw-tag {
  font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 999px; flex-shrink: 0;
}
.tw-tag-armed { background: color-mix(in srgb, var(--up) 12%, transparent); color: color-mix(in srgb, var(--up) 80%, var(--text)); border: 1px solid color-mix(in srgb, var(--up) 25%, transparent); }
.tw-tag-fired { background: color-mix(in srgb, var(--down) 12%, transparent); color: color-mix(in srgb, var(--down) 80%, var(--text)); border: 1px solid color-mix(in srgb, var(--down) 35%, transparent); }
.tw-tag-manual { background: color-mix(in srgb, var(--warn) 12%, transparent); color: color-mix(in srgb, var(--warn) 80%, var(--text)); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.tw-tag-missing, .tw-tag-expired { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); border: 1px solid color-mix(in srgb, var(--muted) 20%, transparent); }
.tw-a17 { font-size: 10.5px; color: color-mix(in srgb, var(--down) 80%, var(--text)); margin-top: 2px; font-style: italic; }
.tw-manual-note { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.tw-manual-note b { color: var(--warn); }

/* ---- W3.4 — Analyst note TTL / staleness badges --------------------------
   Follows the tw-tag design system (pill badges). Amber at >ttl_days, red at
   >2×ttl_days. Uses --warn / --down neutral palette (same as stale-banner).
   Never uses --up / --down zh-flipped colours (rule: staleness is neutral).
   -------------------------------------------------------------------------- */
.cyc-analyst-note { margin-top: 12px; padding: 10px 13px;
  background: color-mix(in srgb, var(--muted) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 22%, transparent);
  border-radius: 11px; }
.cyc-analyst-note .cyc-lbl { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sc-analyst-note-text { font-size: 12.5px; line-height: 1.55; color: var(--text); margin: 0; opacity: .9; }

/* staleness badge (inline, beside the label) */
.sc-narr-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 22%, transparent);
}
.sc-narr-badge-amber {
  color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, transparent);
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
}
.sc-narr-badge-red {
  color: var(--down); background: color-mix(in srgb, var(--down) 10%, transparent);
  border-color: color-mix(in srgb, var(--down) 30%, transparent);
}

/* archetype mechanism check failure chip */
.sc-narr-arch-fail {
  font-size: 10.5px; font-weight: 600;
  color: var(--down); background: color-mix(in srgb, var(--down) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--down) 22%, transparent);
  border-radius: 7px; padding: 3px 8px; margin-bottom: 6px;
}
.sc-narr-arch-manual {
  font-size: 10.5px;
  color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  border-radius: 7px; padding: 3px 8px; margin-bottom: 6px;
}

/* revision provenance note */
.sc-narr-revision {
  font-size: 10.5px; color: var(--muted); font-style: italic;
  margin-bottom: 6px; border-bottom: 1px dashed color-mix(in srgb, var(--muted) 22%, transparent);
  padding-bottom: 5px;
}

/* ── W4.3 / UI-HZ-1 turn-hazard rows (MEASURED cards, focus panel) ────────── */
.cyc-hazard { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px;
  font-size: 11px; line-height: 1.5; color: var(--text); background: var(--panel2);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; margin-bottom: 10px; }
.hz-label { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-right: 4px; flex-shrink: 0; }
.hz-cell { cursor: help; font-variant-numeric: tabular-nums; }
.hz-src { font-size: 9px; font-weight: 600; letter-spacing: .04em; color: var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 30%, transparent);
  border-radius: 999px; padding: 0 5px; vertical-align: middle; margin-left: 2px; }
.hz-sep { color: var(--line); }
/* UI-HZ-1 evidence badges: every probability carries its W4.2 gate verdict.
   PASS = calibrated model cell (calibration-gated vs KM); PRIOR = KM base rate, muted. */
.hz-badge { display: inline-block; font-size: 8.5px; font-weight: 700; letter-spacing: .05em;
  border-radius: 999px; padding: 0 5px; vertical-align: middle; margin-left: 2px; cursor: help; }
.hz-pass { color: var(--up);
  background: color-mix(in srgb, var(--up) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--up) 40%, transparent); }
.hz-prior { color: var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted) 28%, transparent); }
.hz-cell.hz-muted { color: var(--muted); opacity: .8; }

/* ── honest-headline: hazard-first card headline (cycle-honest-headline-w0) ── */
/* Hazard headline block on measured cards */
.cc-hz-headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px;
  font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.cc-hz-headline .cc-arrow { font-size: 11px; }
/* Reference line (overdue / half-cycle ref) */
.cc-proj-ref { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.cc-proj-ref.cc-proj-refuted { opacity: .55; font-style: italic; }
/* Provisional turn line */
.cc-provisional { font-size: 10.5px; color: var(--warn); margin-top: 3px; line-height: 1.35; }
/* Fired-falsifier demotion wrapper on the projection reference */
.cc-proj-demoted { opacity: .5; }
.cc-proj-demoted .cc-proj-ref { color: var(--down); }
/* Hazard headline also used in the focus panel */
.cyc-hz-headline-row { margin-bottom: 10px; padding: 7px 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; }
.cyc-hz-headline-row .cc-hz-headline { font-size: 14px; }
.cyc-hz-headline-row .cc-proj-ref { font-size: 11px; }

/* ============================================================================
   cyc-main — mobile UX idioms (Cycle Intelligence page only)
   ALL rules scoped to html.cyc-main so they cannot leak to markets.html
   (which also carries .cyc-page and its own #cyc-detail, but NOT .cyc-main).
   Mobile-only rules additionally gated under @media (max-width: 880px).
   Desktop ≥ 881px behaviour is pixel-identical to before.
   ========================================================================== */

/* ── 1. Multi-detent bottom sheet geometry (mobile) ────────────────────────
   Three detents: peek (126px visible = unchanged rest look), half (52vh),
   full (modal, sheet top at 8vh ≈ height 92vh starting from bottom).
   The pre-JS state (translateY(calc(100% - 126px))) is identical to the
   existing base rule, so there is no FOUC. cy-half / cy-full are applied
   by JS; cy-dragging disables the CSS transition during 1:1 drag. */
@media (max-width: 880px) {
  html.cyc-main .cyc-detail {
    height: 92vh;
    max-height: 92vh;
    z-index: 60;
  }
  /* rest state: peek 126px — must match the base rule's translateY exactly */
  html.cyc-main .cyc-detail.cy-half  { transform: translateY(calc(100% - 52vh)); }
  html.cyc-main .cyc-detail.cy-full  { transform: translateY(0); }
  html.cyc-main .cyc-detail.cy-dragging { transition: none; will-change: transform; }

  html.cyc-main .cyc-panels { overscroll-behavior: contain; }

  /* larger grab zone for the handle */
  html.cyc-main .cyc-handle {
    min-height: 22px; padding: 13px 0 9px; position: relative; touch-action: none;
  }

  /* ✕ close button injected into the handle by JS */
  html.cyc-main .cy-sheet-x {
    position: absolute; top: 7px; right: 12px; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border: 0; cursor: pointer;
    background: var(--panel2); color: var(--muted); border-radius: 50%;
    font-size: 17px; line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.25); z-index: 2;
    -webkit-tap-highlight-color: transparent;
  }
  html.cyc-main .cy-sheet-x:active { transform: scale(.92); }
}

/* scrim — shown only at the full (modal) detent; z-index 55 = under sheet (60) */
html.cyc-main .cyc-scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.46);
  opacity: 0; pointer-events: none;
  transition: opacity .32s var(--ease);
  z-index: 55;
}

/* ── 2. Mobile category filter: hide non-matching items (not just dim) ──── */
@media (max-width: 880px) {
  html.cyc-main .cyc-chip.gdim,
  html.cyc-main .cyc-card.gdim { display: none; }

  /* picker row: one horizontally-scrollable row */
  html.cyc-main .cyc-groups {
    flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 2px 9px;
  }
  html.cyc-main .cyc-groups::-webkit-scrollbar { display: none; }
  html.cyc-main .cyc-glabel { display: none; }
  html.cyc-main .cyc-gchip,
  html.cyc-main .cyc-gall  { flex: 0 0 auto; }

  /* touch targets */
  html.cyc-main .cyc-gchip { min-height: 40px; display: inline-flex; align-items: center; }
  html.cyc-main .cyc-chip  { min-height: 42px; display: inline-flex; align-items: center; }
  html.cyc-main .cyc-zbtn  { min-height: 38px; display: inline-flex; align-items: center; }
}

/* ── 3. Fullscreen chart mode (mobile) ─────────────────────────────────── */
@media (max-width: 880px) {
  /* anchor for the ⤢ button; kept in CSS (not an inline style) so the
     .cyc-fs { position:fixed } rule below can win when fullscreen is on */
  html.cyc-main .cyc-chartwrap { position: relative; }
  /* ⤢ expand button injected into .cyc-chartwrap by JS */
  html.cyc-main .cyc-chart-fs-btn {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: 1px solid var(--line); border-radius: 11px;
    color: var(--text); font-size: 16px; line-height: 1;
    -webkit-tap-highlight-color: transparent;
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    backdrop-filter: blur(6px);
  }
  html.cyc-main .cyc-chart-fs-btn:active { transform: scale(.94); }

  /* fullscreen wrapper fills the viewport */
  html.cyc-main .cyc-chartwrap.cyc-fs {
    position: fixed; inset: 0; z-index: 80;
    background: var(--bg); display: flex;
    padding: env(safe-area-inset-top) 4px calc(4px + env(safe-area-inset-bottom));
  }
  html.cyc-main .cyc-chartwrap.cyc-fs #cyc-chart {
    width: 100%; height: 100%;
  }
  html.cyc-main .cyc-chartwrap.cyc-fs .cyc-chart-fs-btn {
    top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 6;
  }
}
