* {
  box-sizing: border-box;
}

:root {
  --bg: #07101f;
  --panel: #101b2d;
  --panel-light: #17243a;
  --border: #263750;
  --text: #f3f6fb;
  --muted: #93a4bb;
  --accent: #48a8ff;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  padding: 52px 0 40px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    #0c1728 0%,
    var(--bg) 100%
  );
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 800px;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.lead {
  max-width: 760px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 16px;
}

section {
  margin: 42px 0;
}

h2 {
  margin: 0 0 18px;
  font-size: 22px;
}

.status-grid,
.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.card,
.nav-card {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.card .label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.card strong {
  font-size: 22px;
}

.card p,
.nav-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.nav-card {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.nav-card:active {
  background: var(--panel-light);
}

.step {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.nav-card h3 {
  margin: 5px 0 0;
  font-size: 20px;
}

.alert-list {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.alert-item {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
}

.alert-item:last-child {
  border-bottom: 0;
}

.alert-item strong {
  font-size: 14px;
}

.alert-item span {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 650px) {
  .site-header {
    padding: 36px 0 30px;
  }

  .status-grid,
  .nav-grid {
    grid-template-columns: 1fr;
  }

  section {
    margin: 32px 0;
  }
}

.market-up {
  color: #4fd18b !important;
  font-weight: 600;
}

.market-down {
  color: #ff6b78 !important;
  font-weight: 600;
}

.market-flat {
  color: var(--muted) !important;
}

.market-name {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.market-price,
.market-up,
.market-down,
.market-flat,
.trend-up,
.trend-down,
.trend-neutral,
.technical-date,
.ma-grid span,
.ma-grid strong,
.signal-row span {
  font-size: 15px;
}

.market-price {
  margin-bottom: 6px;
  font-weight: 600;
}

.position-up {
  color: #4fd18b;
}

.position-down {
  color: #ff6b78;
}

.position-flat {
  color: var(--muted);
}

.status-pending {
  color: #f0c66a;
}

.status-confirmed {
  color: #63a4ff;
}

.status-false {
  color: #ff6b78;
}

.signal-up {
  color: #4fd18b;
}

.signal-down {
  color: #ff6b78;
}

.signal-confirmed {
  color: #63a4ff;
}

.signal-false {
  color: #ff6b78;
}

.ma-grid strong {
  font-weight: 700;
}


/* =========================
   MFN 市場カード 最終レイアウト
   ========================= */

.market-card {
  padding: 18px 20px !important;
}

/* 銘柄名 ───────── 判定日 */
.market-title-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin-bottom: 12px !important;
}

.market-name {
  display: block !important;
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 19px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
}

.technical-date {
  display: block !important;
  margin: 0 0 0 auto !important;
  color: var(--muted) !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  white-space: nowrap !important;
}

/* 価格 ───── 騰落 */
.price-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: baseline !important;
  justify-content: flex-start !important;
  gap: 28px !important;
  margin: 0 0 12px !important;
}

.market-price {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

.market-up,
.market-down,
.market-flat {
  font-size: 15px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

/* トレンド 上昇 */
.trend-block {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.trend-line {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 14px !important;
  margin: 0 0 10px !important;
  font-size: 15px !important;
}

.trend-line span,
.trend-line strong {
  font-size: 15px !important;
  line-height: 1.3 !important;
}

.trend-up {
  color: #4fd18b !important;
}

.trend-down {
  color: #ff6b78 !important;
}

.trend-neutral {
  color: #f0c66a !important;
}

/* MA20 / MA50 / MA100 を横3列 */
.ma-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 0 !important;
  margin: 0 !important;
  padding: 10px 0 0 !important;
  border-top: 1px solid var(--border) !important;
}

.ma-grid div {
  margin: 0 !important;
  padding: 2px 8px !important;
  background: transparent !important;
  border-radius: 0 !important;
  text-align: center !important;
}

.ma-grid div + div {
  border-left: 1px solid var(--border) !important;
}

.ma-grid span,
.ma-grid strong {
  display: block !important;
  margin: 0 !important;
  font-size: 15px !important;
  line-height: 1.45 !important;
}

.position-up {
  color: #4fd18b !important;
}

.position-down {
  color: #ff6b78 !important;
}

.position-flat {
  color: var(--muted) !important;
}

/* シグナル */
.signal-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 18px !important;
  margin: 11px 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.signal-row span {
  font-size: 15px !important;
  line-height: 1.3 !important;
}

.signal-up {
  color: #4fd18b !important;
}

.signal-down,
.signal-false {
  color: #ff6b78 !important;
}

.signal-confirmed,
.status-confirmed {
  color: #63a4ff !important;
}

.status-pending {
  color: #f0c66a !important;
}

.status-false {
  color: #ff6b78 !important;
}

/* スマホでも横配置を崩さない */
@media (max-width: 650px) {

  .market-card {
    padding: 18px 16px !important;
  }

  .market-title-row {
    flex-direction: row !important;
    align-items: center !important;
  }

  .technical-date {
    font-size: 13px !important;
  }

  .price-row {
    gap: 24px !important;
  }
}

/* =========================
   MFN 市場カード 確定デザイン
   ========================= */

/* S&P500 / NASDAQ / VIX 等のタイトル */
.market-name {
  color: #f3dfa0 !important;
  font-size: 19px !important;
  font-weight: 800 !important;
  letter-spacing: 0.01em;
}

/* 価格 */
.market-price {
  color: var(--text) !important;
  font-size: 20px !important;
  font-weight: 700 !important;
}

/* 前日比 */
.market-up {
  color: #4fd18b !important;
}

.market-down {
  color: #ff6b78 !important;
}

.market-flat {
  color: var(--muted) !important;
}

/* トレンド */
.trend-up {
  color: #4fd18b !important;
}

.trend-down {
  color: #ff6b78 !important;
}

.trend-neutral {
  color: #f0c66a !important;
}

/* MA位置 */
.position-up {
  color: #4fd18b !important;
}

.position-down {
  color: #ff6b78 !important;
}

.position-flat {
  color: var(--muted) !important;
}

/* シグナル */
.signal-up {
  color: #4fd18b !important;
}

.signal-down,
.signal-false {
  color: #ff6b78 !important;
}

.signal-confirmed,
.status-confirmed {
  color: #63a4ff !important;
}

.status-pending {
  color: #f0c66a !important;
}

.status-false {
  color: #ff6b78 !important;
}

.breakout-row {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.breakout-row span {
  font-size: 15px;
}

.breakout-high {
  color: #4fd18b;
  font-weight: 700;
}

.breakout-low {
  color: #ff6b78;
  font-weight: 700;
}

.breakout-near-high {
  color: #f3dfa0;
  font-weight: 600;
}

.breakout-near-low {
  color: #f0a6a6;
  font-weight: 600;
}

.breakout-high,
.breakout-low {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
}

.breakout-high {
  color: #4fd18b;
  background: rgba(79, 209, 139, 0.10);
  border: 1px solid rgba(79, 209, 139, 0.35);
}

.breakout-low {
  color: #ff6b78;
  background: rgba(255, 107, 120, 0.10);
  border: 1px solid rgba(255, 107, 120, 0.35);
}


/* ================================
   Market Events - Card Style
================================ */

#market-events {
  margin-top: 14px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.market-event-item {
  padding: 15px 16px;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.market-event-item:last-child {
  border-bottom: none;
}

.market-event-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.market-event-date {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.market-event-name {
  color: #f3dfa0;
  font-size: 16px;
  font-weight: 800;
}

.market-event-signal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
}

.market-event-up {
  color: #4fd18b;
}

.market-event-down {
  color: #ff6b78;
}

.market-event-neutral {
  color: #f0c66a;
}

.market-event-status {
  color: #f0c66a;
}

.market-event-evaluation {
  margin-top: 5px;
  color: var(--text);
  font-size: 14px;
}

.market-event-evaluation .confidence-high {
  color: #4fd18b;
}

.market-event-evaluation .confidence-elevated {
  color: #8bd8aa;
}

.market-event-evaluation .confidence-normal {
  color: var(--muted);
}

.market-event-evaluation .confidence-weak {
  color: #f0c66a;
}

.market-event-evaluation .confidence-unverified {
  color: #9aa9c0;
}

.market-events-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 14px;
}



/* =========================================================
   RISK SIGNAL CARD
========================================================= */

.risk-card {
    padding: 24px;
    margin-top: 18px;
    border: 1px solid #2f405c;
    border-radius: 20px;
    background: #111b2d;
}

.risk-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.risk-card-header h3 {
    margin: 0;
}

.risk-status {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.risk-detail {
    margin: 0;
    line-height: 1.7;
    color: #aebbd0;
}

.risk-badge {
    display: inline-block;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #26344c;
    color: #cbd5e1;
}


/* =========================================================
   RISK SIGNAL STATUS
========================================================= */

/* ACTIVE */

.risk-card.risk-active {
    border-color: #2fbf71;
}

.risk-card.risk-active .risk-status {
    color: #42d98b;
}

.risk-card.risk-active .risk-badge {
    background: rgba(47, 191, 113, 0.16);
    color: #42d98b;
}


/* WATCH */

.risk-card.risk-watch {
    border-color: #d8a928;
}

.risk-card.risk-watch .risk-status {
    color: #f0c24b;
}

.risk-card.risk-watch .risk-badge {
    background: rgba(216, 169, 40, 0.16);
    color: #f0c24b;
}


/* NONE */

.risk-card.risk-none {
    border-color: #2f405c;
}

.risk-card.risk-none .risk-status {
    color: #aebbd0;
}

.risk-card.risk-none .risk-badge {
    background: #26344c;
    color: #aebbd0;
}


/* =========================================================
   MARKET CARD FRAME
========================================================= */

.market-card {
    background: #111b2d;
    border: 1px solid #2f405c;
    border-radius: 20px;
    margin-bottom: 18px;
}

/* =========================================================
   MARKET EVENTS CARD
========================================================= */

#market-events {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

/* 1件ごとの変化 */
.event-item {
    background: #111b2d;
    border: 1px solid #2f405c;
    border-radius: 18px;
    padding: 18px 20px;
}

/* 市場名 */
.event-market {
    color: #f3dfa0;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 10px;
}

/* シグナル */
.event-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* 出来高 */
.event-volume {
    color: #aebbd0;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* 判定日 */
.event-date {
    color: #7f8da5;
    font-size: 13px;
    margin-top: 10px;
}

/* データなし・取得中 */
.event-empty {
    background: #111b2d;
    border: 1px solid #2f405c;
    border-radius: 18px;
    padding: 18px 20px;
    color: #aebbd0;
}


/* =========================================
   Market Events 外側の旧枠を削除
   ========================================= */

#market-events {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}


/* =========================================
   RATE ENVIRONMENT
========================================= */

.rates-section {
    margin-top: 24px;
}

.rates-card {
    background: #101b2e;
    border: 1px solid #2b3d57;
    border-radius: 16px;
    padding: 18px;
}

.rates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.rates-title {
    color: #f2d58b;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.rates-badge {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
    color: #a9b6c8;
    background: rgba(169, 182, 200, 0.12);
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.rates-item {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
}

.rates-label {
    display: block;
    color: #9eabc0;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.rates-item strong {
    display: block;
    color: #ffffff;
    font-size: 20px;
    margin-bottom: 6px;
}

.rates-change,
#rates-curve {
    color: #9eabc0;
    font-size: 12px;
}

.rates-summary {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

#rates-curve-direction {
    color: #9eabc0;
    font-size: 13px;
    margin-bottom: 8px;
}

.rates-impact {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

#rates-reason {
    color: #9eabc0;
    font-size: 13px;
    margin: 6px 0 0;
}


/* 金利判定 */

.rates-tailwind {
    color: #63d6a3;
    background: rgba(99,214,163,0.12);
}

.rates-headwind {
    color: #ff7885;
    background: rgba(255,120,133,0.12);
}

.rates-watch {
    color: #f0c66a;
    background: rgba(240,198,106,0.12);
}

.rates-neutral {
    color: #a9b6c8;
    background: rgba(169,182,200,0.12);
}


@media (max-width: 600px) {

    .rates-grid {
        grid-template-columns: 1fr;
    }

    .rates-item {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        text-align: left;
    }

    .rates-label {
        margin-bottom: 0;
    }

    .rates-item strong {
        margin-bottom: 0;
        text-align: right;
    }

    .rates-change,
    #rates-curve {
        grid-column: 2;
        text-align: right;
        margin-top: 4px;
    }
}


/* =========================================
   SENTIMENT ENVIRONMENT
========================================= */

/* カードタイトル */
#sentiment-badge {
    flex-shrink: 0;
}

.market-section:has(#sentiment-badge)
.risk-card-header h3 {
    color: #f3e7a5;
}


/* Fear & Greed 現在値 */
.market-section:has(#sentiment-badge)
.credit-item:first-child {
    margin-top: 12px;
    margin-bottom: 14px;
}

.market-section:has(#sentiment-badge)
.credit-item:first-child span {
    font-size: 20px;
    font-weight: 600;
}

#sentiment-score {
    font-size: 30px;
    font-weight: 700;
    margin-left: 6px;
}

#sentiment-rating {
    font-size: 18px;
    margin-left: 6px;
}


/* =========================================
   SENTIMENT COMPONENTS
========================================= */

#sentiment-toggle {
    cursor: pointer;
}

.sentiment-components {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

.sentiment-component {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sentiment-component > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.sentiment-component strong {
    font-size: 14px;
}

.sentiment-component span {
    font-weight: 700;
    white-space: nowrap;
}

.sentiment-component small {
    display: block;
    margin-top: 4px;
    opacity: 0.7;
}


/* 通常の強欲・恐怖 */

.sentiment-greed {
    color: #72d69b;
}

.sentiment-fear {
    color: #e58a8a;
}

.sentiment-neutral {
    color: #d8d8d8;
}


/* 極端な状態 */

.sentiment-extreme-greed {
    color: #42e884;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(66,232,132,0.35);
}

.sentiment-extreme-fear {
    color: #ff6262;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(255,98,98,0.35);
}


/* SENTIMENT 開閉マーク */

#sentiment-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#sentiment-toggle-icon {
    font-size: 16px;
    color: #9fb0c8;
    margin-left: 12px;
    transition: 0.2s ease;
}

.credit-summary-line {
    margin-top: 18px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 20px;
}

.credit-summary-line strong {
    font-size: 22px;
    font-weight: 700;
}


/* =========================================
   CREDIT ENVIRONMENT SUMMARY
========================================= */

.credit-summary-line {
    margin-top: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
}

#credit-result {
    font-size: 20px;
    font-weight: 600;
}

#credit-status {
    font-size: 20px;
    font-weight: 600;
}



/* Fear & Greed ラベル */
.market-section:has(#sentiment-score)
.credit-item:first-child > span {
    font-size: 20px;
    font-weight: 500;
}

/* Fear & Greed 現在値 */
#sentiment-score {
    font-size: 30px;
    font-weight: 700;
}

/* =========================================================
   MARKET PAGE STYLES (moved from index.php)
   ========================================================= */

.mfnavi-hero {
    padding: 18px 0 8px;
    background: #071225;
  }

  .mfnavi-banner {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
  }

  .mfnavi-intro {
    padding: 24px 2px 10px;
  }

  .mfnavi-intro h1 {
    margin: 0 0 10px;
    font-size: clamp(19px, 4.3vw, 28px);
    line-height: 1.4;
  }

  .mfnavi-intro p {
    margin: 0;
    line-height: 1.7;
    font-size: 14px;
  }

  .market-map-section {
    margin-top: 18px;
  }

  .market-map-card {
    border: 1px solid rgba(104, 145, 199, 0.42);
    border-radius: 18px;
    background: rgba(16, 31, 53, 0.96);
    padding: 22px 18px;
  }

  .market-map-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .market-map-heading h2 {
    margin: 0;
    font-size: 24px;
    color: #f6dc8b;
  }

  .market-map-date {
    font-size: 12px;
    opacity: 0.72;
    white-space: nowrap;
    padding-top: 4px;
  }

  #credit-market-section .risk-card-header h3,
  #sentiment-market-section .risk-card-header h3 {
    color: #f6dc8b;
  }

  .market-map-heading span {
    display: block;
    margin-top: 5px;
    opacity: 0.72;
  }

  .market-map-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 20px;
  }

  .market-map-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    text-decoration: none;
    color: inherit;
    border-right: 1px solid rgba(104, 145, 199, 0.28);
  }

  .market-map-item:last-child {
    border-right: 0;
  }

  .market-map-name {
    font-weight: 700;
    white-space: nowrap;
  }

  .market-map-direction {
    font-size: 35px;
    line-height: 1;
  }

  .market-map-direction.is-neutral {
    color: #f1c84b;
  }

  .market-map-state {
    font-size: 13px;
    opacity: 0.82;
    white-space: nowrap;
  }

  .stock-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .stock-section-links {
    display: flex;
    gap: 8px;
  }

  .stock-section-link {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border: 1px solid rgba(104, 145, 199, 0.42);
    border-radius: 4px;
    background: rgba(16, 31, 53, 0.82);
    color: inherit;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
  }

  .stock-section-link::after {
    content: "›";
    margin-left: 6px;
    opacity: 0.75;
  }

  @media (max-width: 640px) {
    .mfnavi-hero {
      padding-top: 8px;
    }

    .mfnavi-banner {
      border-radius: 10px;
    }

    .mfnavi-intro {
      padding-top: 14px;
    }

    .mfnavi-intro p {
      font-size: 13px;
    }

    .market-map-card {
      padding: 18px 10px;
    }

    .market-map-grid {
      grid-template-columns: repeat(5, minmax(0, 1fr));
      overflow: visible;
      padding-bottom: 0;
    }

    .market-map-item {
      min-width: 0;
      padding: 4px 2px;
    }

    .market-map-name {
      font-size: 12px;
    }

    .market-map-direction {
      font-size: 27px;
    }

    .market-map-state {
      font-size: 10px;
    }
  }


  /* Unified vertical spacing: stock market through market sentiment */
  #stock-market-section,
  #bond-market-section,
  #credit-market-section,
  #fx-market-section,
  #commodity-market-section,
  #crypto-market-section,
  #short-term-market-section,
  #sentiment-market-section {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
  }

  #stock-market-section .stock-section-heading,
  #bond-market-section > h2,
  #credit-market-section > .section-title,
  #fx-market-section > h2,
  #commodity-market-section > h2,
  #crypto-market-section > h2,
  #short-term-market-section > h2,
  #sentiment-market-section > .section-title {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
  }

  #credit-market-section .alert-card,
  #sentiment-market-section .alert-card {
    margin-top: 0 !important;
  }

  #fx-market-section .nav-grid + .nav-grid {
    margin-top: 8px !important;
  }

  /* Bond section: reduce spacing between US 10Y card and US BOND MARKET */
  #bond-market-grid {
    margin-bottom: 8px !important;
  }
  #bond-market-section .rates-section {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* US BOND MARKET: compact overview */
  .rates-card {
    padding: 20px 18px !important;
  }
  .rates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px !important;
  }
  .rates-date {
    font-size: 12px;
    opacity: .72;
    white-space: nowrap;
  }
  .rates-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0 !important;
  }
  .rates-item {
    min-width: 0;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: center;
    border-right: 1px solid rgba(104,145,199,.28) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
  }
  .rates-item:last-child {
    border-right: 0 !important;
  }
  .rates-label,
  .rates-item strong,
  .rates-change,
  #rates-curve {
    display: block;
  }
  .rates-label {
    font-size: 13px !important;
    margin-bottom: 6px;
    white-space: nowrap !important;
    width: 100%;
    text-align: center;
  }
  .rates-item strong {
    font-size: 20px !important;
    line-height: 1.2;
  }
  .rates-change,
  #rates-curve {
    margin-top: 5px;
    font-size: 12px !important;
    white-space: nowrap;
  }
  .rates-summary {
    margin-top: 14px !important;
    padding-top: 13px !important;
  }
  #rates-curve-direction {
    font-size: 13px;
    opacity: .75;
    margin-bottom: 5px;
  }
  #rates-impact {
    font-size: 20px !important;
    margin: 0 !important;
  }
  #rates-reason {
    margin: 5px 0 0 !important;
    font-size: 13px;
  }
  .rates-card.is-inverted #rates-spread,
  .rates-card.is-inverted #rates-curve {
    color: #ff6677 !important;
    font-weight: 700;
  }
  @media (max-width: 640px) {
    .rates-card { padding: 18px 12px !important; }
    .rates-item { padding: 7px 4px !important; }
    .rates-label { font-size: 11px !important; }
    .rates-item strong { font-size: 18px !important; white-space: nowrap !important; }
    .rates-change, #rates-curve { font-size: 11px !important; }
  }


  /* v13: unify spacing between all market sections */
  #stock-market-section,
  #bond-market-section,
  #credit-market-section,
  #fx-market-section,
  #commodity-market-section,
  #crypto-market-section,
  #short-term-market-section,
  #sentiment-market-section {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Same, compact gap from the end of one market to the next heading */
  #stock-market-section + #bond-market-section,
  #bond-market-section + #credit-market-section,
  #credit-market-section + #fx-market-section,
  #fx-market-section + #commodity-market-section,
  #commodity-market-section + #crypto-market-section,
  #crypto-market-section + #short-term-market-section,
  #short-term-market-section + #sentiment-market-section {
    margin-top: 18px !important;
  }

  /* Remove inherited bottom margins that were creating uneven gaps */
  #stock-market-section > .nav-grid,
  #bond-market-section > .rates-section,
  #credit-market-section > .alert-card,
  #fx-market-section > .nav-grid:last-child,
  #commodity-market-section > .nav-grid,
  #crypto-market-section > .nav-grid,
  #short-term-market-section > .nav-grid,
  #sentiment-market-section > .nav-grid:last-child,
  #sentiment-market-section > .alert-card {
    margin-bottom: 0 !important;
  }

  /* Market heading -> first card: same spacing everywhere */
  #stock-market-section .stock-section-heading,
  #bond-market-section > h2,
  #credit-market-section > .section-title,
  #fx-market-section > h2,
  #commodity-market-section > h2,
  #crypto-market-section > h2,
  #short-term-market-section > h2,
  #sentiment-market-section > .section-title {
    margin: 0 0 8px !important;
  }

  /* Stock title and navigation buttons share one vertical center line */
  #stock-market-section .stock-section-heading {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    min-height: 38px;
  }
  #stock-market-section .stock-section-heading > h2 {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 38px !important;
    white-space: nowrap;
  }
  #stock-market-section .stock-section-links {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    margin: 0 !important;
    padding: 0 !important;
  }
  #stock-market-section .stock-section-link {
    box-sizing: border-box;
    min-height: 38px;
    justify-content: center;
    line-height: 1.2;
  }


  /* v14: hard-normalize vertical rhythm between market sections */
  #stock-market-section,
  #bond-market-section,
  #credit-market-section,
  #fx-market-section,
  #commodity-market-section,
  #crypto-market-section,
  #short-term-market-section,
  #sentiment-market-section {
    display: flow-root !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #stock-market-section ~ section {
    margin-top: 12px !important;
  }

  #market-grid,
  #bond-market-grid,
  #fx-market-grid,
  #commodity-market-grid,
  #crypto-market-grid,
  #short-term-market-grid,
  #credit-market-section .alert-card,
  #sentiment-market-section .alert-card,
  #bond-market-section .rates-section {
    margin-bottom: 0 !important;
  }

  #market-grid > :last-child,
  #bond-market-grid > :last-child,
  #fx-market-grid > :last-child,
  #commodity-market-grid > :last-child,
  #crypto-market-grid > :last-child,
  #short-term-market-grid > :last-child {
    margin-bottom: 0 !important;
  }

  #stock-market-section .stock-section-heading,
  #bond-market-section > h2,
  #credit-market-section > .section-title,
  #fx-market-section > h2,
  #commodity-market-section > h2,
  #crypto-market-section > h2,
  #short-term-market-section > h2,
  #sentiment-market-section > .section-title {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
  }



  /* CREDIT ENVIRONMENT: compact 2 x 2 overview */
  #credit-market-section .risk-card {
    padding: 20px 18px !important;
  }

  #credit-market-section .risk-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px !important;
  }

  #credit-market-section .risk-card-header h3 {
    margin: 0 !important;
    font-size: 18px !important;
    line-height: 1.15;
    white-space: nowrap;
  }

  #credit-market-section #credit-date {
    flex: 0 0 auto;
    font-size: 12px;
    white-space: nowrap;
  }

  #credit-market-section .credit-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0 !important;
    margin: 0 !important;
    border-top: 1px solid rgba(104,145,199,.22);
    border-bottom: 1px solid rgba(104,145,199,.22);
  }

  #credit-market-section .credit-item {
    min-width: 0;
    padding: 14px 10px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  #credit-market-section .credit-item:nth-child(odd) {
    border-right: 1px solid rgba(104,145,199,.22) !important;
  }

  #credit-market-section .credit-item:nth-child(-n+2) {
    border-bottom: 1px solid rgba(104,145,199,.22) !important;
  }

  #credit-market-section .credit-item > span {
    font-size: 13px;
    opacity: .78;
    margin-bottom: 5px;
    white-space: nowrap;
  }

  #credit-market-section .credit-item > strong {
    font-size: 20px;
    line-height: 1.2;
    margin: 0;
  }

  #credit-market-section .credit-item > small {
    margin-top: 5px;
    font-size: 12px;
    opacity: .72;
    white-space: nowrap;
  }

  #credit-market-section .credit-summary-line {
    margin-top: 16px !important;
    padding-top: 0 !important;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
  }

  #credit-market-section .credit-summary-line strong,
  #credit-market-section .credit-summary-line span {
    font-size: 20px;
  }

  #credit-market-section #credit-detail {
    margin-top: 6px !important;
    margin-bottom: 0 !important;
  }

  @media (max-width: 420px) {
    #credit-market-section .risk-card-header h3 {
      font-size: 16px !important;
    }
    #credit-market-section .credit-item {
      padding: 12px 6px !important;
    }
    #credit-market-section .credit-item > strong {
      font-size: 19px;
    }
    #credit-market-section .credit-item > small {
      font-size: 11px;
    }
  }

/* =========================================================
   MARKET CARD SPACING - unified vertical rhythm
   ========================================================= */

#market-grid,
#bond-market-grid,
#fx-market-grid,
#commodity-market-grid,
#crypto-market-grid,
#short-term-market-grid {
  gap: 16px !important;
}

#market-grid .market-card,
#bond-market-grid .market-card,
#fx-market-grid .market-card,
#commodity-market-grid .market-card,
#crypto-market-grid .market-card,
#short-term-market-grid .market-card {
  margin-bottom: 0 !important;
}

/* Same-market companion cards use the same 16px separation. */
#bond-market-section .rates-section {
  margin-top: 16px !important;
}

#fx-market-section .nav-grid + .nav-grid {
  margin-top: 16px !important;
}

/* =========================================================
   FINAL SPACING RHYTHM
   Same-market cards: 16px / Between market groups: compact
   ========================================================= */
:root {
  --mfn-card-gap: 16px;
  --mfn-section-gap: 4px;
  --mfn-heading-gap: 8px;
}

/* Same-market cards */
#market-grid,
#bond-market-grid,
#fx-market-grid,
#commodity-market-grid,
#crypto-market-grid,
#short-term-market-grid {
  gap: var(--mfn-card-gap) !important;
  margin-bottom: 0 !important;
}

#market-grid .market-card,
#bond-market-grid .market-card,
#fx-market-grid .market-card,
#commodity-market-grid .market-card,
#crypto-market-grid .market-card,
#short-term-market-grid .market-card {
  margin-bottom: 0 !important;
}

/* Bond companion card: match FX card spacing exactly */
#bond-market-section #bond-market-grid {
  margin-bottom: 0 !important;
}

#bond-market-section .rates-section {
  margin-top: var(--mfn-card-gap) !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
}

/* FX companion card is the spacing reference */
#fx-market-section .nav-grid + .nav-grid {
  margin-top: var(--mfn-card-gap) !important;
}

/* Market group to next market group: deliberately tighter */
#stock-market-section,
#bond-market-section,
#credit-market-section,
#fx-market-section,
#commodity-market-section,
#crypto-market-section,
#short-term-market-section,
#sentiment-market-section {
  margin-bottom: 0 !important;
}

#stock-market-section + #bond-market-section,
#bond-market-section + #credit-market-section,
#credit-market-section + #fx-market-section,
#fx-market-section + #commodity-market-section,
#commodity-market-section + #crypto-market-section,
#crypto-market-section + #short-term-market-section,
#short-term-market-section + #sentiment-market-section {
  margin-top: var(--mfn-section-gap) !important;
}

/* Keep heading-to-first-card rhythm consistent */
#stock-market-section .stock-section-heading,
#bond-market-section > h2,
#credit-market-section > .section-title,
#fx-market-section > h2,
#commodity-market-section > h2,
#crypto-market-section > h2,
#short-term-market-section > h2,
#sentiment-market-section > .section-title {
  margin-top: 0 !important;
  margin-bottom: var(--mfn-heading-gap) !important;
}

/* =========================================================
   MFNavi GUIDE LINKS
   ========================================================= */
.title-with-guide,
.section-title-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.title-with-guide h2,
.section-title-row h2,
.title-with-guide h3 {
  margin: 0 !important;
}

.guide-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(72, 168, 255, 0.48);
  border-radius: 50%;
  color: #7bbcff;
  background: rgba(72, 168, 255, 0.08);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.guide-link:active {
  background: rgba(72, 168, 255, 0.18);
}

.market-name.title-with-guide {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
}

.market-name .guide-link {
  width: 20px;
  height: 20px;
  font-size: 12px;
}

.rates-title.title-with-guide {
  display: inline-flex !important;
}

.rates-title .guide-link,
#credit-market-section .risk-card-header .guide-link,
#sentiment-market-section .risk-card-header .guide-link {
  width: 21px;
  height: 21px;
  font-size: 12px;
}

#sentiment-market-section .risk-card-header {
  align-items: center;
}

#sentiment-market-section #sentiment-toggle {
  flex: 1 1 auto;
}

/* =========================================================
   GUIDE PAGE
   ========================================================= */
.guide-page {
  padding-bottom: 64px;
}

.guide-hero {
  padding: 28px 0 18px;
}

.guide-back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.guide-hero h1 {
  margin: 0;
  font-size: clamp(28px, 7vw, 44px);
}

.guide-hero p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.guide-nav-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -16px 18px;
  padding: 10px 16px;
  background: rgba(7,16,31,.96);
  border-top: 1px solid rgba(104,145,199,.16);
  border-bottom: 1px solid rgba(104,145,199,.22);
  backdrop-filter: blur(10px);
}

.guide-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.guide-nav::-webkit-scrollbar {
  display: none;
}

.guide-nav a {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.guide-section {
  scroll-margin-top: 76px;
  margin: 0 0 18px !important;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.guide-section h2 {
  margin: 0 0 12px;
  color: #f3dfa0;
  font-size: 22px;
}

.guide-section h3 {
  margin: 18px 0 8px;
  font-size: 17px;
}

.guide-section p {
  margin: 8px 0;
  color: #c8d2e2;
  font-size: 15px;
  line-height: 1.75;
}

.guide-key {
  margin: 12px 0;
  padding: 12px 14px;
  border-left: 3px solid #48a8ff;
  background: rgba(72,168,255,.07);
  border-radius: 0 10px 10px 0;
  color: #e8eef8;
  line-height: 1.7;
}

.guide-reading {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.guide-reading > div {
  padding: 11px 12px;
  border: 1px solid rgba(104,145,199,.20);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
}

.guide-reading strong {
  display: block;
  margin-bottom: 3px;
  color: #fff;
  font-size: 14px;
}

.guide-reading span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.guide-up { color: #4fd18b; }
.guide-down { color: #ff6b78; }
.guide-neutral { color: #f0c66a; }

.guide-note {
  color: var(--muted) !important;
  font-size: 13px !important;
}

@media (min-width: 720px) {
  .guide-reading {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}


/* =========================================
   SENTIMENT CURRENT VALUE — 2 LINE LABEL
========================================= */
#sentiment-market-section .sentiment-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 14px;
    margin-bottom: 18px;
}

#sentiment-market-section .sentiment-name {
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    min-width: 0;
    height: 64px;
}

#sentiment-market-section .sentiment-name > span,
#sentiment-market-section .sentiment-name > small {
    display: flex;
    align-items: center;
    flex: 1 1 50%;
    margin: 0;
    font-size: 21px;
    line-height: 1;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: #eef4fb;
}

#sentiment-market-section .sentiment-current-value {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 10px;
    white-space: nowrap;
}

#sentiment-market-section #sentiment-score {
    margin-left: 0;
    font-size: 36px;
    line-height: 1;
    font-weight: 750;
}

#sentiment-market-section #sentiment-rating {
    margin-left: 0;
    font-size: 17px;
    line-height: 1;
    color: #dce5f1;
}

@media (max-width: 480px) {
    #sentiment-market-section .sentiment-current {
        gap: 14px;
    }

    #sentiment-market-section .sentiment-name > span,
    #sentiment-market-section .sentiment-name > small {
        font-size: 20px;
    }

    #sentiment-market-section #sentiment-score {
        font-size: 34px;
    }

    #sentiment-market-section #sentiment-rating {
        font-size: 16px;
    }
}


/* =========================================================
   v38: SENTIMENT - three independent cards / single-circle guide icon
   ========================================================= */
#sentiment-market-section .sentiment-fear-greed-card { margin-bottom: var(--mfn-card-gap) !important; }
#sentiment-market-section .sentiment-standalone-grid { grid-template-columns: 1fr !important; margin: 0 0 var(--mfn-card-gap) !important; }
#sentiment-market-section .sentiment-standalone-grid:last-child { margin-bottom: 0 !important; }
#sentiment-market-section .sentiment-standalone-card { margin: 0 !important; }
#sentiment-market-section .sentiment-standalone-card .label { color: #f3dfa0; font-size: 18px; font-weight: 800; letter-spacing: .01em; }
.guide-link { background: transparent !important; }


/* =========================================================
   v39: SENTIMENT layout refinement
   ========================================================= */

/* Current Fear & Greed score: centered, no duplicated inner title */
#sentiment-market-section .sentiment-current {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100%;
  padding: 8px 0 18px !important;
  margin: 0 !important;
  border: 0 !important;
}

#sentiment-market-section .sentiment-current-value {
  width: 100%;
  display: flex !important;
  justify-content: center !important;
  align-items: baseline !important;
  gap: 12px !important;
  text-align: center;
}

#sentiment-market-section #sentiment-score {
  font-size: 42px !important;
  line-height: 1 !important;
}

#sentiment-market-section #sentiment-rating {
  font-size: 18px !important;
}

/* Historical values: left-to-right, wrapped into two rows */
#sentiment-market-section .sentiment-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(104,145,199,.22);
  border-bottom: 1px solid rgba(104,145,199,.22);
}

#sentiment-market-section .sentiment-history-item {
  min-width: 0;
  padding: 11px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#sentiment-market-section .sentiment-history-item:nth-child(1),
#sentiment-market-section .sentiment-history-item:nth-child(2),
#sentiment-market-section .sentiment-history-item:nth-child(3) {
  border-bottom: 1px solid rgba(104,145,199,.22);
}

#sentiment-market-section .sentiment-history-item:not(:nth-child(3n)) {
  border-right: 1px solid rgba(104,145,199,.22);
}

#sentiment-market-section .sentiment-history-item span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

#sentiment-market-section .sentiment-history-item strong {
  margin-top: 3px;
  font-size: 17px;
  line-height: 1.2;
}

/* second row has two values and keeps left-to-right reading */
#sentiment-market-section .sentiment-history-item:nth-child(4) {
  grid-column: 1 / 2;
}

#sentiment-market-section .sentiment-history-item:nth-child(5) {
  grid-column: 2 / 3;
}

@media (max-width: 420px) {
  #sentiment-market-section #sentiment-score {
    font-size: 38px !important;
  }
  #sentiment-market-section .sentiment-history-item {
    padding-left: 2px;
    padding-right: 2px;
  }
  #sentiment-market-section .sentiment-history-item span {
    font-size: 11px;
  }
}


/* =========================================================
   v40: MARKET COMPARISON
   ========================================================= */
.market-comparison-section {
  margin: 18px 0 4px !important;
}
.market-comparison-title {
  margin-bottom: 8px !important;
}
.market-comparison-card {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.market-comparison-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.market-comparison-header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.market-comparison-header strong {
  color: #f3dfa0;
  font-size: 15px;
}
.market-comparison-header span {
  color: var(--muted);
  font-size: 12px;
}
#market-comparison-date {
  white-space: nowrap;
}
.market-comparison-legend {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 8px 12px;
  margin-bottom: 12px;
}
.market-comparison-legend-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 8px minmax(0,1fr) auto;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.market-comparison-legend-item > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-comparison-legend-item strong {
  font-size: 12px;
  font-weight: 700;
}
.market-comparison-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.market-comparison-chart-wrap {
  position: relative;
  width: 100%;
  min-height: 300px;
}
#market-comparison-chart {
  display: block;
  width: 100%;
  height: 380px;
}
.market-comparison-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 640px) {
  .market-comparison-card { padding: 14px 10px; }
  .market-comparison-header { align-items: flex-start; }
  .market-comparison-header > div { flex-direction: column; gap: 1px; }
  .market-comparison-legend {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px 10px;
  }
  #market-comparison-chart { height: 300px; }
}


/* =========================================================
   v41: MARKET COMPARISON - individual mini charts
   ========================================================= */

.market-comparison-section {
  margin: 18px 0 4px !important;
}

.market-comparison-title {
  margin-bottom: 8px !important;
}

.market-comparison-intro {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 0 2px;
}

.market-comparison-intro strong {
  color: #f3dfa0;
  font-size: 15px;
}

.market-comparison-intro span {
  color: var(--muted);
  font-size: 12px;
}

#market-comparison-date {
  margin-left: auto;
  white-space: nowrap;
}

.market-comparison-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.market-comparison-mini-card {
  padding: 16px 14px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.market-comparison-mini-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.market-comparison-mini-header > strong {
  color: #f3dfa0;
  font-size: 17px;
  font-weight: 800;
}

.market-comparison-mini-header > span {
  font-size: 15px !important;
  font-weight: 800 !important;
  white-space: nowrap;
}

.market-comparison-mini-chart-wrap {
  width: 100%;
  min-height: 180px;
}

.market-comparison-mini-chart {
  display: block;
  width: 100%;
  height: 210px;
}

.market-comparison-loading {
  position: static !important;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 13px;
}

@media (min-width: 760px) {
  .market-comparison-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .market-comparison-intro {
    gap: 4px 8px;
  }

  #market-comparison-date {
    width: 100%;
    margin-left: 0;
  }

  .market-comparison-mini-card {
    padding: 14px 10px 8px;
  }

  .market-comparison-mini-chart {
    height: 180px;
  }
}



/* =========================================================
   v42: 4-ASSET COMPARISON + LOCAL DOLLAR / SHORT-BOND CHARTS
   ========================================================= */
.market-comparison-cards,
.market-comparison-mini-card,
.market-comparison-intro {
  display: none !important;
}

.market-comparison-card {
  display: block !important;
  padding: 18px !important;
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
}

.market-comparison-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 12px !important;
  margin-bottom: 14px !important;
}

.market-comparison-header > div {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

.market-comparison-legend {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px 12px !important;
  margin-bottom: 12px !important;
}

.market-comparison-chart-wrap {
  position: relative !important;
  width: 100% !important;
  min-height: 300px !important;
}

#market-comparison-chart {
  display: block !important;
  width: 100% !important;
  height: 380px !important;
}

.market-context-chart {
  margin-top: 16px;
  padding: 16px 14px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.market-context-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 7px;
}

.market-context-chart-header strong {
  color: #f3dfa0;
  font-size: 15px;
  font-weight: 800;
}

.market-context-chart-header span {
  font-size: 14px !important;
  font-weight: 800 !important;
}

#dollar-index-20d-chart,
#short-bond-20d-chart {
  display: block;
  width: 100%;
  height: 190px;
}

@media (max-width: 640px) {
  .market-comparison-card {
    padding: 14px 10px !important;
  }

  .market-comparison-header {
    flex-direction: column !important;
    gap: 5px !important;
  }

  #market-comparison-chart {
    height: 300px !important;
  }

  .market-context-chart {
    padding: 14px 10px 8px;
  }

  #dollar-index-20d-chart,
  #short-bond-20d-chart {
    height: 170px;
  }
}


/* =========================================================
   v43: 6-ASSET COMPARISON LEGEND
   ========================================================= */
.market-comparison-legend {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 640px) {
  .market-comparison-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


/* =========================================================
   v216: MOBILE TITLE / DATA-DATE WRAP
   CREDIT ENVIRONMENT + FX market cards
   ========================================================= */
@media (max-width: 640px) {
  /* CREDIT ENVIRONMENT: title and data date each get their own half */
  #credit-market-section .risk-card-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
  }

  #credit-market-section .risk-card-header h3 {
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.25 !important;
  }

  #credit-market-section #credit-date {
    min-width: 0 !important;
    margin-left: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.45 !important;
    text-align: right !important;
  }

  /* FX cards: long market name and data timestamp may wrap independently */
  #fx-market-grid .market-title-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
  }

  #fx-market-grid .market-name {
    min-width: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.25 !important;
  }

  #fx-market-grid .technical-date {
    min-width: 0 !important;
    margin-left: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.45 !important;
    text-align: right !important;
  }
}
