/* CWZ homepage — owner-supplied design implemented on the REAL app.
   Source of truth for this skin: task-dir designer/spec.md (sha256 a9f8085c…), not the retired r6
   cloud-wave spec. The r6 band/wave artwork, its data URI and its negative-z halo are REMOVED here rather
   than layered over (§8.2 of the spec); the new hero is a decorative, fixed-height blue gradient band with
   hand-authored fine lines drawn by index.html's own inline SVG.

   Nothing in this file fabricates data. Colours here are decoration and state treatment only; every
   price, quote, timestamp, provider name, unit and warning string still comes from the app. */

.cwz-spike {
  /* ---- semantic palette (spec §4) --------------------------------------------------------------- */
  --background: #F4F7FB;
  --card: #FFFFFF;
  --foreground: #0B1B3F;
  --text: #24324F;
  /* The reference's #6B7A99 measures 4.31:1 on white and #98A4BD just 2.51:1 — both fail small text. The
     existing #486581 (6.08:1 on white, 5.66:1 on #F4F7FB) is kept for every meta/notice/subtitle line. */
  --muted-foreground: #486581;
  --accent: #0B6BFF;
  --accent-hover: #0957D6;
  --accent-foreground: #FFFFFF;
  /* The protected surface used under white text that has to sit on the bright hero (spec §6). */
  --accent-strong: #0A3FA8;
  --surface-soft: #EEF5FF;
  --line: #E3E9F2;      /* decorative hairlines only */
  --border: #7B8FA8;    /* interactive outlines: 3.31:1 on white */
  --focus: #0957D6;
  --danger: #A12222;
  --danger-soft: #FDECEC;
  --warning: #7A5410;
  --warning-soft: #FFF8EB;
  --success: #0B7A3B;
  --disabled-foreground: #486581;
  --disabled-background: #E4ECF5;

  /* ---- geometry (spec §3, §5) ------------------------------------------------------------------- */
  --header-h: 64px;
  --hero-h: 430px;
  --shadow-lg: 0 24px 60px -18px rgba(11, 40, 100, .25), 0 2px 6px rgba(11, 40, 100, .05);
  --shadow-sm: 0 1px 2px rgba(11, 40, 100, .06), 0 4px 14px -6px rgba(11, 40, 100, .10);

  position: relative;
  margin: 0;
  min-height: 100%;
  /* §5: the lower page is pale grey, not white — the white form and market panel lift off it. */
  background: var(--background);
  color: var(--text);
  font-family: system-ui, 'Noto Sans Thai', 'Leelawadee UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.cwz-spike *,
.cwz-spike *::before,
.cwz-spike *::after { box-sizing: border-box; }

/* Zero-specificity reset. Written as `.cwz-spike p` (0,1,1) it outranked every single-class margin
   below, so the whole vertical rhythm silently collapsed to 0 and the layout shipped tighter than the
   approved design. :where() contributes nothing, so any class rule can set a margin. */
:where(.cwz-spike) :where(p, h1, h2, h3, dl, dd, dt) { margin: 0; }

.cwz-spike :focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 40;
  padding: 10px 16px;
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ---------------------------------------------------------------- sticky white header (spec §3) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #FFFFFF;
  border-bottom: 1px solid var(--line);
  /* Optional in the spec: with a solid white fill above, the blur only matters when something scrolls
     under the header. No @supports branch is needed — the fallback IS the opaque white background. */
  backdrop-filter: blur(12px);
}
.header-inner,
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}
.header-inner {
  min-height: var(--header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  /* auto height: Thai glyphs and 200% zoom may need more than 64px — never clip the header. */
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
/* The mark is decoration: the wordmark beside it is the name, so the SVG is aria-hidden in the markup.
   The APPROVED artwork paints its own rounded tile (rect rx=11 + its own gradient), so CSS supplies no
   background and no border-radius here — either one would clip or double-paint the supplied geometry. */
.brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
  display: block;
}
.brand-wordmark .brand-z { color: var(--accent); }

.language {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.language-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
}
.language-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--background);
}
.lang-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.lang-btn[aria-pressed="true"] {
  background: #FFFFFF;
  border-color: var(--line);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ----------------------------------------------------------------------------- decorative hero ----- */
/* Fixed height + absolute + pointer-events:none = it cannot shift or block anything (spec §3). It is
   aria-hidden in the markup because it carries no information. */
.page-hero {
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  height: var(--hero-h);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* EXACT reference hero (spec §3): radial highlight + 120deg blue gradient. No cloud, no wave. */
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(120, 200, 255, 0.55), transparent 60%),
    linear-gradient(120deg, #0A55E0 0%, #0B6BFF 45%, #2F95FF 100%);
}
.page-hero svg { display: block; width: 100%; height: 100%; }

.page {
  position: relative;
  z-index: 1;
  padding-top: 28px;
  padding-bottom: 64px;
}

/* ---------------------------------------------------------------------- read-only banner ---------- */
.mode-banner {
  margin: 24px 0 0;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  /* §6 contrast correction: the reference's plain white-on-translucent treatment measured 3.6:1. This
     translucent navy keeps the bright hero visible behind it and puts white text at >=4.9:1 in the worst
     case (composited over pure white), better over the real backdrop. */
  background: rgba(10, 63, 168, 0.75);
  color: #FFFFFF;
}
.mode-badge {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mode-hint {
  font-size: 13.5px;
  line-height: 1.5;
  color: #FFFFFF;
}
/* Unavailable is a different FACT, not a decoration: the surface shifts to a dark red that still carries
   white text, and the words change with it. Never colour alone. */
.mode-banner.is-unavailable { background: rgba(122, 28, 28, 0.85); }
.mode-banner.is-unavailable .mode-badge { color: #FFFFFF; }

.page-title {
  margin: 34px 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: #FFFFFF;
}
.page-title-icon { width: 24px; height: 24px; flex: 0 0 auto; margin-top: -2px; }
/* The subtitle sits on the brightest part of the gradient, which alone gives white only 3.06-6.2:1. It
   carries its own compact navy underlay so the text run stays readable without darkening the hero. */
.page-subtitle {
  display: inline-block;
  max-width: 46rem;
  margin: 4px 0 26px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(10, 63, 168, 0.75);
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------- white form card ------ */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
/* The retired r6 halo stays switched off; kept as a declaration so nobody re-adds it by accident. */
.card::before { display: none; }

.converter { display: block; }

.fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.field {
  position: relative;
  min-width: 0;
  padding: 18px 20px 20px;
  /* §4: 1.5px interactive outline at 3.31:1, not the decorative hairline. */
  border: 1.5px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#to-field { background: #FAFCFF; }
.field:focus-within { border-color: var(--accent); }

.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-foreground);
}

.amount-input,
.amount-output {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  padding: 0;
  margin: 10px 0 14px;
  overflow-wrap: anywhere;
}
.amount-input::placeholder { color: var(--muted-foreground); }
/* No outline:none here: it defeated the shared :focus-visible ring on the primary input. */
.amount-output { display: block; }
.amount-input[aria-invalid="true"] { color: var(--danger); }

.field-error {
  font-size: 14px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 6px 10px;
}
.field-error[hidden] { display: none; }

.asset-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  color: var(--foreground);
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}
.asset-trigger:hover { background: var(--surface-soft); }
.asset-identity {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--foreground);
}
.asset-identity bdi { font-weight: 700; }
.chevron { color: var(--muted-foreground); margin-left: auto; flex: none; }

.asset-badge {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #FFFFFF;
  color: var(--accent-hover);
}
.asset-badge svg { display: block; width: 18px; height: 18px; }

.swap-cell { display: flex; align-items: center; justify-content: center; }
.swap-btn {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  /* No transform here: swapping is an action, not a decoration (spec §3, §7). */
  transition: background 120ms ease;
}
.swap-btn:hover { background: var(--surface-soft); }
.swap-icon { display: block; width: 20px; height: 20px; }

.rate-line {
  margin-top: 26px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.rate-line:empty { display: none; }

.actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  margin-top: 18px;
}
.freshness {
  min-width: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--background);
}
.freshness-line {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.freshness-line[hidden] { display: none; }

.primary-btn {
  min-height: 56px;
  min-width: 180px;
  padding: 16px 48px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-foreground);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(11, 107, 255, 0.65);
  transition: background 120ms ease, color 120ms ease;
}
.primary-btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary-btn:disabled {
  background: var(--disabled-background);
  border-color: var(--disabled-background);
  color: var(--disabled-foreground);
  cursor: not-allowed;
  /* Stated rather than implied: a disabled control carries NO shadow and no accent tint, so it can never
     borrow "lift" from the surface around it and look pressable. */
  box-shadow: none;
}

.hint {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.notice {
  margin-top: 24px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.55;
}
.notice[data-tone="danger"] { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.notice[data-tone="warning"] { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.notice[hidden] { display: none; }

/* ------------------------------------------------------------------------------ pickers ----------- */
.picker {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 352px;
  overflow-y: auto;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.picker[hidden] { display: none; }
.picker-head { display: flex; gap: 8px; align-items: center; }
.picker-search {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  color: var(--foreground);
  background: var(--card);
}
.picker-close {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
}
.picker-meta {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted-foreground);
}
.picker-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.picker-option {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--foreground);
}
.picker-option[aria-selected="true"] { background: var(--surface-soft); border-color: var(--border); }
.picker-option:hover,
.picker-option.is-active { background: var(--surface-soft); }
.picker-option .opt-symbol { font-weight: 700; }
.picker-option .opt-name {
  display: block;
  font-size: 14px;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.picker-option .opt-selected {
  font-size: 14px;
  color: var(--accent-hover);
  flex: none;
}
.picker-empty { padding: 8px 4px; font-size: 14px; color: var(--muted-foreground); }
.picker-more {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.picker-more[hidden] { display: none; }

/* ------------------------------------------------------------------------------ preview ----------- */
.preview-card { margin-top: 28px; }
.preview-card[hidden] { display: none; }
.preview-title { font-size: 20px; font-weight: 700; }
.preview-echo {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 16px 0;
}
.preview-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted-foreground);
}
.preview-amount,
.preview-net {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.cost-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  margin-top: 8px;
  font-size: 16px;
}
.cost-list dt { color: var(--muted-foreground); }
.cost-list dd { text-align: right; font-variant-numeric: tabular-nums; }

.diagnostics {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 12px 16px;
  font-size: 14px;
}
.diagnostics summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted-foreground);
}
.diagnostics pre {
  margin: 8px 0 0;
  padding: 8px;
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.is-busy { position: relative; }

/* --------------------------------------------------------------------- market panel (8 + F&G) ----- */
/* Spec §3: title/title, cards/gauge, attribution/attribution; four cards across on desktop and the F&G
   tile as its own 290px column. Every grid child carries min-width:0 and the card text wraps, so a long
   price or a long provider string can never push the page wider than the viewport (the reference's own
   390px overflow bug is corrected this way, never masked with overflow-x:hidden). */
.market-panel {
  margin: 28px 0 0;
  padding: 30px;
  position: relative;
  z-index: 0;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  grid-template-areas:
    "title title"
    "cards gauge"
    "attribution attribution";
  grid-template-rows: auto auto auto;
  align-items: stretch;
  column-gap: 24px;
  row-gap: 14px;
}

.market-title {
  grid-area: title;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted-foreground);
}

.market-attribution { grid-area: attribution; }

.market-cards {
  grid-area: cards;
  display: grid;
  /* Four across on desktop by contract (spec §3), two on tablet, two on phone, one only at <=360. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-content: stretch;
}

.market-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.market-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.market-card-logo { width: 30px; height: 30px; border-radius: 50%; flex: none; }

.market-card-name {
  font-weight: 700;
  font-size: 14.5px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.market-card-symbol {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
}

.market-card-price {
  margin: 8px 0 2px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.market-card-change {
  margin: 0;
  align-self: flex-start;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}
.market-card-change-up { color: var(--success); background: #E7F7F0; }
.market-card-change-down { color: var(--danger); background: var(--danger-soft); }

/* No history => the renderer emits no sparkline at all. This class only styles one when it exists. */
.market-card-spark { display: block; width: 100%; height: 32px; margin-top: 8px; }
.market-card-spark path { stroke: var(--accent); }

.market-card-note,
.market-card-asof {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}

.market-card-stale { border-style: dashed; }
.market-card-unavailable,
.market-card-approval-required { background: var(--warning-soft); border-color: #E7CFA4; }
.market-card-empty { background: var(--disabled-background); }

.market-attribution {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.market-attribution a { color: var(--accent); }
.market-attribution:empty { margin: 0; }

/* ------------------------------------------------------------------------ Fear & Greed tile ------ */
.fear-greed {
  grid-area: gauge;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  margin-top: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #EEF5FF 0%, #FFFFFF 60%);
}

.gauge-title {
  flex: 0 0 auto;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--foreground);
}

.gauge-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Geometry is the shipped renderer's (viewBox 240x140, needle maths untouched); only the box is styled. */
.gauge-svg {
  flex: 0 1 auto;
  min-height: 96px;
  width: 100%;
  max-width: 230px;
  height: auto;
  max-height: 160px;
  display: block;
}

.fear-greed[data-level='extreme-fear'] { --level-color: var(--danger); }
.fear-greed[data-level='fear'] { --level-color: var(--warning); }
.fear-greed[data-level='neutral'] { --level-color: var(--muted-foreground); }
.fear-greed[data-level='greed'] { --level-color: var(--success); }
.fear-greed[data-level='extreme-greed'] { --level-color: var(--success); }
.fear-greed[data-level='unknown'] { --level-color: var(--accent); }

/* The track is decorative: the number, the classification word and the needle repeat the scale. */
.gauge-track { stroke: var(--disabled-background); }
.gauge-progress { stroke: var(--level-color, var(--accent)); }
.gauge-needle { stroke: var(--foreground); }
.gauge-hub { fill: var(--foreground); }
.fear-greed[data-state='stale'] .gauge-progress { stroke: var(--warning); }

.gauge-readout {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
  max-width: 100%;
}
.gauge-value {
  margin: 0;
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.gauge-classification {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--level-color, var(--accent));
}
.gauge-note {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--warning);
}
.gauge-asof {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted-foreground);
  text-align: center;
}
.gauge-attribution {
  margin: auto 0 0;
  padding-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.gauge-attribution a { color: var(--accent); text-decoration: underline; }
.gauge-attribution a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --------------------------------------------------------------- responsive (spec §5) ------------- */
@media (min-width: 721px) {
  .fields {
    grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
    align-items: center;
  }
  .preview-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .market-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "cards"
      "gauge"
      "attribution";
    grid-template-rows: none;
    padding: 20px;
  }
  .market-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .cwz-spike { --hero-h: 320px; }
  .header-inner,
  .page { padding-left: 16px; padding-right: 16px; }
  .header-inner { padding-top: 12px; padding-bottom: 12px; }
  /* Visually hidden on phones, never removed: the group keeps its accessible name (spec §3). */
  .language-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .page { padding-top: 20px; padding-bottom: 40px; }
  .page-title { font-size: 26px; margin: 26px 0 14px; }
  .page-subtitle { font-size: 14px; }
  .card { padding: 20px; border-radius: 18px; }
  .fields { gap: 14px; }
  .swap-cell { justify-content: flex-start; }
  .swap-btn { transform: rotate(90deg); }
  .amount-input,
  .amount-output { font-size: 34px; }
  .actions { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .primary-btn { width: 100%; }
  .picker { position: static; max-height: none; margin-top: 8px; }
  .market-panel { padding: 16px; border-radius: 18px; }
  .market-card { padding: 12px; }
  .market-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fear-greed { padding: 16px; }
  .gauge-body { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; flex-wrap: wrap; }
  .gauge-svg { flex: 0 0 auto; width: min(100%, 200px); max-width: none; max-height: none; }
  .gauge-readout { margin-top: 0; }
  .gauge-attribution { margin: 8px 0 0; }
}

@media (max-width: 360px) {
  .market-cards { grid-template-columns: minmax(0, 1fr); }
}

/* Motion is decoration here: no pulse, no slide, no rotate-on-hover anywhere. */
@media (prefers-reduced-motion: reduce) {
  .cwz-spike *,
  .cwz-spike *::before,
  .cwz-spike *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

/* Forced colours: keep every control boundary and the focus ring visible when the palette is replaced. */
@media (forced-colors: active) {
  .asset-trigger,
  .picker,
  .picker-option,
  .lang-btn,
  .swap-btn,
  .primary-btn,
  .field,
  .card,
  .market-panel,
  .market-card,
  .fear-greed,
  .mode-banner { border: 1px solid CanvasText; }
  .cwz-spike :focus-visible { outline: 3px solid Highlight; }
  .page-hero { display: none; }
  .page-title,
  .page-subtitle { color: CanvasText; }
}
