/* CCR Main S56S R1 — canonical current-UI / theme overlay
   Built on accepted S56R R1. Core S56N R2 CSS remains separate and unchanged.
   This file owns recent UI, background environment calibration, semantic colour
   tokens, and the desktop-only Change BG utility. */

/* === CANONICAL CCR UI THEME TOKENS ===
   Appearance/user settings remain the colour inputs. These semantic tokens provide
   one current owner for global contrast calibration and future component migration. */
:root{
  --ccr-ui-bg-dim-enhanced:.075;
  --ccr-ui-bg-dim-moon:.10;
  --ccr-ui-bg-dim-mars:.08;
  --ccr-ui-bg-dim-jupiter:.09;
  --ccr-ui-bg-dim-classic:.055;
  --ccr-ui-text-lift-primary:1.06;
  --ccr-ui-text-lift-body:1.08;
  --ccr-ui-text-lift-muted:1.08;
  --ccr-ui-text-primary-source:var(--ccr-card-headline-color,#e2c3cc);
  --ccr-ui-text-body-source:var(--ccr-body-text-color,#e9f0f7);
  --ccr-ui-text-secondary-source:var(--ccr-helper-copy-color,#b8c6d4);
  --ccr-ui-text-meta-source:var(--ccr-pills-meta-color,#d7e0e8);
  --ccr-ui-surface-card:rgba(10,18,28,.18);
  --ccr-ui-surface-card-strong:rgba(9,16,25,.28);
  --ccr-ui-border-soft:rgba(255,255,255,.08);
  --ccr-ui-border-standard:rgba(255,255,255,.12);
  --ccr-ui-accent-gold:rgba(232,214,164,.92);
  --ccr-ui-background-dim:var(--ccr-ui-bg-dim-enhanced);
}
html[data-ccr-map-background="enhanced-r1"]{--ccr-ui-background-dim:var(--ccr-ui-bg-dim-enhanced)}
html[data-ccr-map-background="moon-r1"]{--ccr-ui-background-dim:var(--ccr-ui-bg-dim-moon)}
html[data-ccr-map-background="mars-r1"]{--ccr-ui-background-dim:var(--ccr-ui-bg-dim-mars)}
html[data-ccr-map-background="jupiter-r1"]{--ccr-ui-background-dim:var(--ccr-ui-bg-dim-jupiter)}
html[data-ccr-map-background="classic"]{--ccr-ui-background-dim:var(--ccr-ui-bg-dim-classic)}

/* ===== S56J R1 — Profile / planetary backgrounds — BEGIN ===== */
/* CCR Main S56J R1 — selectable terrestrial and planetary backgrounds in Profile. */
:root{
  --ccr-map-desktop-image:url('../images/backgrounds/world-intelligence-map-enhanced-r1-tile.webp');
  --ccr-map-mobile-image:url('../images/backgrounds/world-intelligence-map-enhanced-r1-tile.webp');
}

@media (min-width:761px){
  .site-world-map-runner::before,
  .site-world-map-runner::after{
    background-image:var(--ccr-map-desktop-image);
    background-repeat:repeat-x;
    background-size:50% 100%;
  }

  html[data-ccr-map-background="classic"] .site-world-map-runner::before,
  html[data-ccr-map-background="classic"] .site-world-map-runner::after,
  html[data-ccr-map-background="moon-r1"] .site-world-map-runner::before,
  html[data-ccr-map-background="moon-r1"] .site-world-map-runner::after,
  html[data-ccr-map-background="mars-r1"] .site-world-map-runner::before,
  html[data-ccr-map-background="mars-r1"] .site-world-map-runner::after,
  html[data-ccr-map-background="jupiter-r1"] .site-world-map-runner::before,
  html[data-ccr-map-background="jupiter-r1"] .site-world-map-runner::after{
    background-repeat:no-repeat;
    background-size:100% 100%;
  }
}

@media (max-width:760px){
  .site-world-map-runner::before,
  .site-world-map-runner::after{
    background-image:var(--ccr-map-mobile-image);
  }

  html[data-ccr-map-background="moon-r1"] .site-world-map-runner,
  html[data-ccr-map-background="mars-r1"] .site-world-map-runner,
  html[data-ccr-map-background="jupiter-r1"] .site-world-map-runner{
    width:400%;
  }

  html[data-ccr-map-background="moon-r1"] .site-world-map-runner::before,
  html[data-ccr-map-background="moon-r1"] .site-world-map-runner::after,
  html[data-ccr-map-background="mars-r1"] .site-world-map-runner::before,
  html[data-ccr-map-background="mars-r1"] .site-world-map-runner::after,
  html[data-ccr-map-background="jupiter-r1"] .site-world-map-runner::before,
  html[data-ccr-map-background="jupiter-r1"] .site-world-map-runner::after{
    background-repeat:no-repeat;
    background-size:100% 100%;
    background-position:50% 50%;
  }
}

.ccr-entry-gate::after{
  background-image:var(--ccr-map-mobile-image);
}

html[data-ccr-map-background="moon-r1"] .ccr-entry-gate::after,
html[data-ccr-map-background="mars-r1"] .ccr-entry-gate::after,
html[data-ccr-map-background="jupiter-r1"] .ccr-entry-gate::after{
  animation-name:ccrEntryPlanetaryBackgroundDrift;
}

@keyframes ccrEntryPlanetaryBackgroundDrift{
  from{background-position:0 50%}
  to{
    background-position:-400vh 50%;
    background-position:-400dvh 50%;
  }
}

body[data-page="home"] .settings-map-picker{
  display:grid;
  gap:10px;
  padding-bottom:13px;
  margin-bottom:12px;
  border-bottom:1px solid rgba(255,255,255,.06);
}

body[data-page="home"] .settings-map-picker__head{
  display:grid;
  gap:4px;
}

body[data-page="home"] .settings-map-picker__options{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:10px;
}

body[data-page="home"] .settings-map-choice{
  position:relative;
  display:grid;
  grid-template-rows:76px auto;
  gap:8px;
  min-width:0;
  padding:7px;
  border:1px solid rgba(255,255,255,.075);
  border-radius:13px;
  background:rgba(5,12,20,.24);
  color:var(--text);
  font:inherit;
  text-align:left;
  cursor:pointer;
  transition:border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body[data-page="home"] .settings-map-choice:hover{
  border-color:rgba(137,190,255,.28);
  background:rgba(23,43,62,.30);
  transform:translateY(-1px);
}

body[data-page="home"] .settings-map-choice:focus-visible{
  outline:2px solid rgba(137,190,255,.72);
  outline-offset:2px;
}

body[data-page="home"] .settings-map-choice.is-selected{
  border-color:rgba(232,214,164,.34);
  background:linear-gradient(180deg, rgba(232,214,164,.075), rgba(33,55,75,.19));
  box-shadow:inset 0 0 0 1px rgba(232,214,164,.055), 0 8px 18px rgba(0,0,0,.12);
}

body[data-page="home"] .settings-map-choice__preview{
  display:block;
  width:100%;
  height:76px;
  overflow:hidden;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.08);
  background-repeat:no-repeat;
  background-position:center center;
  background-size:cover;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035);
}

body[data-page="home"] .settings-map-choice__copy{
  display:grid;
  gap:2px;
  min-width:0;
  padding:0 2px 2px;
}

body[data-page="home"] .settings-map-choice__copy strong{
  font-size:.84rem;
  font-weight:600;
  color:rgba(242,247,252,.94);
}

body[data-page="home"] .settings-map-choice__copy small{
  font-size:.72rem;
  line-height:1.35;
  color:var(--text-2);
}

body[data-page="home"] .settings-map-choice__mark{
  position:absolute;
  top:12px;
  right:12px;
  display:grid;
  place-items:center;
  width:24px;
  height:24px;
  border-radius:50%;
  border:1px solid rgba(232,214,164,.34);
  background:rgba(7,15,24,.82);
  color:#f0d58d;
  font-size:.78rem;
  font-weight:700;
  box-shadow:0 4px 12px rgba(0,0,0,.22);
}

body[data-page="home"] .settings-map-choice:not(.is-selected) .settings-map-choice__mark{
  opacity:0;
}

@media (max-width:520px){
  body[data-page="home"] .settings-map-picker__options{
    grid-template-columns:1fr;
  }
  body[data-page="home"] .settings-map-choice{
    grid-template-columns:116px minmax(0,1fr);
    grid-template-rows:auto;
    align-items:center;
  }
  body[data-page="home"] .settings-map-choice__preview{
    height:64px;
  }
}

@media (prefers-reduced-motion:reduce){
  body[data-page="home"] .settings-map-choice{
    transition:none;
  }
}
/* ===== S56J R1 — Profile / planetary backgrounds — END ===== */

/* ===== S56K R1 — Background-aware ribbon tabs — BEGIN ===== */
/* CCR Main S56K R1 — background-derived translucent CCR Intelligence tabs. */

/*
 * The selected background ID already lives on <html>. Keep the ribbon markup
 * and behavior untouched; only feed each visual layer a coordinated palette.
 * Enhanced is also the no-attribute fallback to avoid a startup color flash.
 */
body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-rgb:20,45,62;
  --ccr-context-tab-active-rgb:27,57,75;
  --ccr-context-tab-edge-rgb:104,151,177;
  --ccr-context-tab-alpha:.52;
  --ccr-context-tab-active-alpha:.64;
  --ccr-context-tab-hover-alpha:.68;
  --ccr-context-tab-rail-alpha:.12;
}

html[data-ccr-map-background="enhanced-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-rgb:20,45,62;
  --ccr-context-tab-active-rgb:27,57,75;
  --ccr-context-tab-edge-rgb:104,151,177;
  --ccr-context-tab-alpha:.52;
  --ccr-context-tab-active-alpha:.64;
  --ccr-context-tab-hover-alpha:.68;
  --ccr-context-tab-rail-alpha:.12;
}

html[data-ccr-map-background="moon-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-rgb:56,69,76;
  --ccr-context-tab-active-rgb:70,83,90;
  --ccr-context-tab-edge-rgb:168,186,196;
  --ccr-context-tab-alpha:.52;
  --ccr-context-tab-active-alpha:.64;
  --ccr-context-tab-hover-alpha:.68;
  --ccr-context-tab-rail-alpha:.11;
}

html[data-ccr-map-background="mars-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-rgb:90,53,36;
  --ccr-context-tab-active-rgb:111,65,43;
  --ccr-context-tab-edge-rgb:200,135,90;
  --ccr-context-tab-alpha:.46;
  --ccr-context-tab-active-alpha:.58;
  --ccr-context-tab-hover-alpha:.62;
  --ccr-context-tab-rail-alpha:.10;
}

html[data-ccr-map-background="jupiter-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-rgb:61,52,45;
  --ccr-context-tab-active-rgb:78,65,55;
  --ccr-context-tab-edge-rgb:183,151,121;
  --ccr-context-tab-alpha:.48;
  --ccr-context-tab-active-alpha:.60;
  --ccr-context-tab-hover-alpha:.64;
  --ccr-context-tab-rail-alpha:.10;
}

html[data-ccr-map-background="classic"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-rgb:16,26,39;
  --ccr-context-tab-active-rgb:22,35,51;
  --ccr-context-tab-edge-rgb:136,163,194;
  --ccr-context-tab-alpha:.62;
  --ccr-context-tab-active-alpha:.74;
  --ccr-context-tab-hover-alpha:.78;
  --ccr-context-tab-rail-alpha:.14;
}

/* Strip wash. The gold seam remains the common CCR identity anchor. */
body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  background:
    linear-gradient(
      180deg,
      rgba(var(--ccr-context-tab-rgb),var(--ccr-context-tab-rail-alpha)),
      rgba(var(--ccr-context-tab-rgb),.035)
    ) !important;
}

/* Inactive face: a neutral light skim over the derived translucent base. */
body[data-page="home"] .ccr-intelligence-ribbon__tab{
  border-color:rgba(var(--ccr-context-tab-edge-rgb),.34) !important;
  border-bottom-color:var(--ccr-ribbon-tab-bottom) !important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.092),rgba(255,255,255,.020)),
    rgba(var(--ccr-context-tab-rgb),var(--ccr-context-tab-alpha)) !important;
  box-shadow:
    0 -5px 14px rgba(0,0,0,.15),
    4px 0 12px rgba(0,0,0,.10),
    inset 0 1px 0 rgba(255,255,255,.085),
    inset 0 -1px 0 var(--ccr-ribbon-tab-bottom-inset) !important;
}

/* Edge modelling is palette-aware too, avoiding a residual blue cap. */
body[data-page="home"] .ccr-intelligence-ribbon__tab::before{
  background:
    linear-gradient(
      90deg,
      rgba(0,0,0,.12),
      transparent 13%,
      transparent 84%,
      rgba(var(--ccr-context-tab-edge-rgb),.075)
    ) !important;
}

body[data-page="home"] .ccr-intelligence-ribbon__tab:hover,
body[data-page="home"] .ccr-intelligence-ribbon__tab:focus-visible{
  border-color:rgba(235,202,136,.46) !important;
  border-bottom-color:var(--ccr-ribbon-tab-bottom) !important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.125),rgba(255,255,255,.030)),
    rgba(var(--ccr-context-tab-active-rgb),var(--ccr-context-tab-hover-alpha)) !important;
}

/* Active face: more legible than inactive, but still visibly part of the scene. */
body[data-page="home"] .ccr-intelligence-ribbon__tab.is-active{
  border-color:var(--ccr-tab-card-border-active) !important;
  border-bottom-color:transparent !important;
  background:
    radial-gradient(circle at 50% 0%,rgba(255,224,154,.15),transparent 43%),
    linear-gradient(180deg,rgba(255,255,255,.135),rgba(255,255,255,.032)),
    rgba(var(--ccr-context-tab-active-rgb),var(--ccr-context-tab-active-alpha)) !important;
  box-shadow:
    0 -8px 19px rgba(0,0,0,.20),
    0 0 13px var(--ccr-ribbon-active-glow),
    6px 0 14px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,247,223,.14),
    inset 1px 0 0 rgba(233,202,136,.10),
    inset -1px 0 0 rgba(233,202,136,.08) !important;
}

/* The close affordance is a component of the face, not a separate grey disc. */
body[data-page="home"] .ccr-intelligence-ribbon__tab-close{
  border-color:rgba(var(--ccr-context-tab-edge-rgb),.36) !important;
  background:rgba(var(--ccr-context-tab-edge-rgb),.10) !important;
  color:rgba(244,248,252,.76) !important;
}

body[data-page="home"] .ccr-intelligence-ribbon__tab-close:hover,
body[data-page="home"] .ccr-intelligence-ribbon__tab-close:focus-visible{
  border-color:rgba(235,202,136,.54) !important;
  background:rgba(235,202,136,.14) !important;
  color:rgba(255,247,229,.96) !important;
}

/* Match the higher-specificity active-source close rule used on mobile. */
@media (max-width:760px){
  body[data-page="home"] .ccr-intelligence-ribbon__tab{
    border-color:rgba(var(--ccr-context-tab-edge-rgb),.34) !important;
    border-bottom-color:var(--ccr-mobile-ribbon-tab-bottom) !important;
  }

  body[data-page="home"] .ccr-intelligence-ribbon__tab.is-active{
    border-color:var(--ccr-mobile-ribbon-active-border) !important;
    border-bottom-color:transparent !important;
  }

  body[data-page="home"] .ccr-intelligence-ribbon__tab--source.is-active .ccr-intelligence-ribbon__tab-close{
    border-color:rgba(var(--ccr-context-tab-edge-rgb),.40) !important;
    background:rgba(var(--ccr-context-tab-edge-rgb),.12) !important;
    color:rgba(255,247,229,.90) !important;
  }

  body[data-page="home"] .ccr-intelligence-ribbon__tab--source.is-active .ccr-intelligence-ribbon__tab-close:hover,
  body[data-page="home"] .ccr-intelligence-ribbon__tab--source.is-active .ccr-intelligence-ribbon__tab-close:focus-visible{
    border-color:rgba(235,202,136,.54) !important;
    background:rgba(235,202,136,.14) !important;
    color:rgba(255,247,229,.96) !important;
  }
}

@media (prefers-reduced-motion:reduce){
  body[data-page="home"] .ccr-intelligence-ribbon__tab,
  body[data-page="home"] .ccr-intelligence-ribbon__tab-close{
    transition:none !important;
  }
}
/* ===== S56K R1 — Background-aware ribbon tabs — END ===== */

/* ===== S56L R1 — Foreground hierarchy — BEGIN ===== */
/* CCR Main S56L R1 — foreground hierarchy calibration for planetary backgrounds.
 * Presentation-only: strengthen ribbon tabs, calm RSS imagery, increase RSS copy-surface density,
 * while preserving the existing ribbon geometry and scroll behavior.
 */

/* Shared foreground tokens. Enhanced is also the no-attribute startup fallback. */
body[data-page="home"]{
  --ccr-context-card-rgb:16,34,48;
  --ccr-context-card-alpha:.14;
  --ccr-context-card-text-alpha:.18;
  --ccr-context-rss-image-brightness:.84;
  --ccr-context-rss-image-saturation:.82;
}

body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-alpha:.75;
  --ccr-context-tab-active-alpha:.90;
  --ccr-context-tab-hover-alpha:.84;
  --ccr-context-tab-rail-alpha:.14;
}

html[data-ccr-map-background="enhanced-r1"] body[data-page="home"]{
  --ccr-context-card-rgb:16,34,48;
  --ccr-context-card-alpha:.14;
  --ccr-context-card-text-alpha:.18;
}
html[data-ccr-map-background="enhanced-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-alpha:.75;
  --ccr-context-tab-active-alpha:.90;
  --ccr-context-tab-hover-alpha:.84;
  --ccr-context-tab-rail-alpha:.14;
}

html[data-ccr-map-background="moon-r1"] body[data-page="home"]{
  --ccr-context-card-rgb:38,48,54;
  --ccr-context-card-alpha:.16;
  --ccr-context-card-text-alpha:.20;
  --ccr-context-rss-image-brightness:.83;
  --ccr-context-rss-image-saturation:.78;
}
html[data-ccr-map-background="moon-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-alpha:.77;
  --ccr-context-tab-active-alpha:.91;
  --ccr-context-tab-hover-alpha:.85;
  --ccr-context-tab-rail-alpha:.15;
}

html[data-ccr-map-background="mars-r1"] body[data-page="home"]{
  --ccr-context-card-rgb:61,37,28;
  --ccr-context-card-alpha:.14;
  --ccr-context-card-text-alpha:.18;
  --ccr-context-rss-image-brightness:.84;
  --ccr-context-rss-image-saturation:.80;
}
html[data-ccr-map-background="mars-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-alpha:.74;
  --ccr-context-tab-active-alpha:.89;
  --ccr-context-tab-hover-alpha:.82;
  --ccr-context-tab-rail-alpha:.13;
}

html[data-ccr-map-background="jupiter-r1"] body[data-page="home"]{
  --ccr-context-card-rgb:46,40,36;
  --ccr-context-card-alpha:.15;
  --ccr-context-card-text-alpha:.19;
  --ccr-context-rss-image-brightness:.84;
  --ccr-context-rss-image-saturation:.80;
}
html[data-ccr-map-background="jupiter-r1"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-alpha:.76;
  --ccr-context-tab-active-alpha:.90;
  --ccr-context-tab-hover-alpha:.84;
  --ccr-context-tab-rail-alpha:.14;
}

html[data-ccr-map-background="classic"] body[data-page="home"]{
  --ccr-context-card-rgb:13,23,34;
  --ccr-context-card-alpha:.17;
  --ccr-context-card-text-alpha:.21;
  --ccr-context-rss-image-brightness:.86;
  --ccr-context-rss-image-saturation:.84;
}
html[data-ccr-map-background="classic"] body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  --ccr-context-tab-alpha:.84;
  --ccr-context-tab-active-alpha:.94;
  --ccr-context-tab-hover-alpha:.90;
  --ccr-context-tab-rail-alpha:.16;
}

/* Restore the physical folder-tab read while retaining background-derived colour. */
body[data-page="home"] .ccr-intelligence-ribbon__tabs{
  background:
    linear-gradient(180deg,
      rgba(var(--ccr-context-tab-rgb),var(--ccr-context-tab-rail-alpha)),
      rgba(var(--ccr-context-tab-rgb),.055)
    ) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab{
  border-color:rgba(var(--ccr-context-tab-edge-rgb),.42) !important;
  border-bottom-color:var(--ccr-ribbon-tab-bottom) !important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.115),rgba(255,255,255,.026)),
    rgba(var(--ccr-context-tab-rgb),var(--ccr-context-tab-alpha)) !important;
  box-shadow:
    0 -6px 16px rgba(0,0,0,.18),
    5px 0 14px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.11),
    inset 0 -1px 0 var(--ccr-ribbon-tab-bottom-inset) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab:hover,
body[data-page="home"] .ccr-intelligence-ribbon__tab:focus-visible{
  border-color:rgba(235,202,136,.52) !important;
  background:
    linear-gradient(180deg,rgba(255,255,255,.145),rgba(255,255,255,.034)),
    rgba(var(--ccr-context-tab-active-rgb),var(--ccr-context-tab-hover-alpha)) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab.is-active{
  border-color:rgba(235,202,136,.66) !important;
  border-bottom-color:transparent !important;
  background:
    radial-gradient(circle at 50% 0%,rgba(255,224,154,.17),transparent 43%),
    linear-gradient(180deg,rgba(255,255,255,.14),rgba(255,255,255,.034)),
    rgba(var(--ccr-context-tab-active-rgb),var(--ccr-context-tab-active-alpha)) !important;
  box-shadow:
    0 -9px 20px rgba(0,0,0,.22),
    0 0 15px rgba(232,190,112,.10),
    6px 0 15px rgba(0,0,0,.13),
    inset 0 1px 0 rgba(255,247,223,.20),
    inset 1px 0 0 rgba(233,202,136,.14),
    inset -1px 0 0 rgba(233,202,136,.10) !important;
}
/* Calm RSS photography without allowing the map texture through the image itself. */
body[data-page="home"] .ccr-intelligence-ribbon__rss-media{
  position:relative;
  isolation:isolate;
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-media img{
  filter:
    brightness(var(--ccr-context-rss-image-brightness))
    saturate(var(--ccr-context-rss-image-saturation))
    contrast(.97);
  transition:filter .22s ease, transform .22s ease;
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-media::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
  background:
    linear-gradient(180deg,rgba(8,13,20,.035) 0%,rgba(8,13,20,.06) 58%,rgba(8,13,20,.28) 100%),
    linear-gradient(90deg,rgba(var(--ccr-context-card-rgb),.06),rgba(var(--ccr-context-card-rgb),.02));
}
@media (hover:hover) and (pointer:fine){
  body[data-page="home"] .ccr-intelligence-ribbon__rss-card:hover .ccr-intelligence-ribbon__rss-media img,
  body[data-page="home"] .ccr-intelligence-ribbon__rss-media-link:hover .ccr-intelligence-ribbon__rss-media img{
    filter:brightness(.96) saturate(.94) contrast(1);
  }
}

/* Give the copy area a slightly denser glass surface so lunar/planet texture does not fight the text. */
body[data-page="home"] .ccr-intelligence-ribbon__rss-body{
  background:
    linear-gradient(180deg,rgba(255,255,255,.024),rgba(255,255,255,.010)),
    rgba(var(--ccr-context-card-rgb),var(--ccr-context-card-alpha));
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-card--text{
  background:
    linear-gradient(180deg,rgba(255,255,255,.026),rgba(255,255,255,.011)),
    rgba(var(--ccr-context-card-rgb),var(--ccr-context-card-text-alpha)) !important;
}

@media (max-width:760px){
  body[data-page="home"] .ccr-intelligence-ribbon__tab{
    border-bottom-color:var(--ccr-mobile-ribbon-tab-bottom) !important;
  }
  body[data-page="home"] .ccr-intelligence-ribbon__tab.is-active{
    border-bottom-color:transparent !important;
  }
}

@media (prefers-reduced-motion:reduce){
  body[data-page="home"] .ccr-intelligence-ribbon__rss-media img{
    transition:none !important;
  }
}
/* ===== S56L R1 — Foreground hierarchy — END ===== */

/* ===== S56M/S56S — Dashboard navigation + background transition — BEGIN ===== */
/* Dashboard remains a navigation icon. The old background-cycle navigation icon and
   its mobile-dock compression rules are intentionally retired in S56S. */
body[data-page="home"] .dashboard-icon{
  display:inline-grid;
  place-items:center;
  width:20px;
  height:20px;
  line-height:1;
}
body[data-page="home"] .dashboard-icon-svg{
  display:block;
  width:20px;
  height:20px;
  overflow:visible;
}
body[data-page="home"] .dashboard-launch-btn:hover .dashboard-icon-svg,
body[data-page="home"] .dashboard-launch-btn:focus-visible .dashboard-icon-svg{
  filter:drop-shadow(0 0 6px rgba(232,214,164,.13));
}
body[data-page="home"] .site-world-map-bg.is-background-cycling{
  animation:ccrBackgroundCycleReveal 390ms ease-out both;
}
@keyframes ccrBackgroundCycleReveal{
  0%{opacity:.84}
  58%{opacity:.96}
  100%{opacity:1}
}
@media (max-width:760px){
  body[data-page="home"] .dashboard-icon,
  body[data-page="home"] .dashboard-icon-svg{
    width:21px;
    height:21px;
  }
}
@media (prefers-reduced-motion:reduce){
  body[data-page="home"] .site-world-map-bg.is-background-cycling{
    animation:none !important;
  }
}
/* ===== S56M/S56S — Dashboard navigation + background transition — END ===== */

/* ===== S56N R1 — News Intel / Schedule navigation — BEGIN ===== */
/* CCR Main S56N R1 — desktop Schedule launcher + admin News Intel iframe launcher. */

body[data-page="home"] .schedule-icon{
  display:inline-grid;
  place-items:center;
  width:20px;
  height:20px;
  line-height:1;
}
body[data-page="home"] .schedule-icon-svg{
  display:block;
  width:20px;
  height:20px;
  overflow:visible;
}
body[data-page="home"] .schedule-launch-btn:hover .schedule-icon-svg,
body[data-page="home"] .schedule-launch-btn:focus-visible .schedule-icon-svg{
  filter:drop-shadow(0 0 6px rgba(232,214,164,.13));
}

/* Admin-only News Intel companion button, kept visually secondary to Invite Friend. */
body[data-page="home"] .home-news-intel-btn{
  appearance:none;
  box-sizing:border-box;
  flex:0 0 auto;
  display:inline-grid;
  place-items:center;
  width:30px;
  min-width:30px;
  height:30px;
  min-height:30px;
  padding:0;
  border:1px solid rgba(233,202,136,.17);
  border-radius:999px;
  background:linear-gradient(180deg, rgba(233,202,136,.060), rgba(233,202,136,.024));
  color:rgba(226,216,188,.80);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055),0 7px 16px rgba(0,0,0,.09);
  cursor:pointer;
  transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease,box-shadow .16s ease;
}
body[data-page="home"] .home-news-intel-btn[hidden]{
  display:none !important;
}
body[data-page="home"] .home-news-intel-btn:hover,
body[data-page="home"] .home-news-intel-btn:focus-visible{
  border-color:rgba(239,218,166,.34);
  background:linear-gradient(180deg, rgba(233,202,136,.12), rgba(233,202,136,.050));
  color:rgba(255,237,190,.96);
  transform:translateY(-1px);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.085),0 9px 20px rgba(0,0,0,.14),0 0 10px rgba(232,190,112,.055);
  outline:none;
}
body[data-page="home"] .home-news-intel-btn:active{
  transform:translateY(1px) scale(.955);
}
body[data-page="home"] .home-news-intel-icon,
body[data-page="home"] .home-news-intel-icon-svg{
  display:block;
  width:18px;
  height:18px;
  pointer-events:none;
}
body[data-page="home"] .ccr-intelligence-ribbon__search .home-news-intel-btn{
  width:28px !important;
  min-width:28px !important;
  height:28px !important;
  min-height:28px !important;
  padding:0 !important;
  border-color:rgba(233,202,136,.14) !important;
  background:rgba(233,202,136,.036) !important;
  color:rgba(224,211,177,.76) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.045),0 6px 14px rgba(0,0,0,.08) !important;
  font-size:0 !important;
  letter-spacing:0 !important;
  text-transform:none !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__search .home-news-intel-btn:hover,
body[data-page="home"] .ccr-intelligence-ribbon__search .home-news-intel-btn:focus-visible{
  border-color:rgba(239,218,166,.30) !important;
  background:rgba(233,202,136,.075) !important;
  color:rgba(255,235,181,.92) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.065),0 8px 18px rgba(0,0,0,.12),0 0 9px rgba(232,190,112,.045) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__search .home-news-intel-icon,
body[data-page="home"] .ccr-intelligence-ribbon__search .home-news-intel-icon-svg{
  width:17px;
  height:17px;
}
body[data-page="home"] .home-footer-invite-tools{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-width:0;
}
body[data-page="home"] .home-footer-invite-tools[hidden]{
  display:none !important;
}
body[data-page="home"] .home-footer-invite-tools:not([hidden]) + .footer-about-btn{
  margin-left:10px;
}

/* News Intel uses the same interaction model as CCR live-app iframe overlays:
   near-fullscreen on desktop, full-screen on mobile, same-origin and unsandboxed. */
body.ccr-news-intel-frame-open{
  overflow:hidden !important;
}
body.ccr-news-intel-frame-open .mobile-bottom-dock{
  display:none !important;
}
.ccr-news-intel-frame-layer{
  position:fixed;
  inset:0;
  z-index:9950;
  color:var(--text,rgba(238,244,250,.94));
  font-family:var(--font-sans,Inter,"Noto Sans JP",system-ui,sans-serif);
}
.ccr-news-intel-frame-backdrop{
  position:absolute;
  inset:0;
  background:rgba(3,8,14,.54);
  backdrop-filter:blur(10px) saturate(1.04);
  -webkit-backdrop-filter:blur(10px) saturate(1.04);
}
.ccr-news-intel-frame-shell{
  position:absolute;
  top:max(16px,calc(env(safe-area-inset-top,0px) + 10px));
  left:max(20px,calc(env(safe-area-inset-left,0px) + 12px));
  right:max(20px,calc(env(safe-area-inset-right,0px) + 12px));
  bottom:max(16px,calc(env(safe-area-inset-bottom,0px) + 10px));
  width:min(1680px,calc(100vw - 40px));
  margin-inline:auto;
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:0;
  overflow:hidden;
  border:1px solid rgba(214,229,248,.13);
  border-radius:22px;
  background:linear-gradient(180deg,rgba(21,32,45,.96),rgba(6,11,18,.96));
  box-shadow:0 30px 84px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.052);
}
.ccr-news-intel-frame-head{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-height:54px;
  padding:10px 12px 10px 17px;
  border-bottom:1px solid rgba(255,255,255,.075);
  background:linear-gradient(180deg,rgba(31,44,59,.96),rgba(18,28,39,.94));
}
.ccr-news-intel-frame-titlewrap{
  min-width:0;
}
.ccr-news-intel-frame-titlewrap p{
  margin:0 0 2px;
  color:rgba(213,225,237,.58);
  font-size:.62rem;
  line-height:1;
  font-weight:700;
  letter-spacing:.15em;
  text-transform:uppercase;
}
.ccr-news-intel-frame-titlewrap h2{
  margin:0;
  color:rgba(242,247,252,.94);
  font-size:1.04rem;
  line-height:1.15;
  font-weight:650;
  letter-spacing:-.01em;
}
.ccr-news-intel-frame-close{
  flex:0 0 auto;
  width:36px !important;
  min-width:36px !important;
  height:36px !important;
  min-height:36px !important;
  padding:0 !important;
  justify-content:center !important;
  border-color:rgba(255,255,255,.13) !important;
  background:rgba(8,14,22,.62) !important;
}
.ccr-news-intel-frame-wrap{
  position:relative;
  flex:1 1 auto;
  min-width:0;
  min-height:0;
  overflow:hidden;
  background:#07101a;
}
.ccr-news-intel-frame{
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  height:100%;
  border:0;
  background:#07101a;
}
.ccr-news-intel-frame-loading{
  position:absolute;
  inset:0;
  z-index:2;
  display:grid;
  place-items:center;
  pointer-events:none;
  color:rgba(222,232,241,.72);
  background:
    radial-gradient(circle at 50% 42%,rgba(94,130,163,.14),transparent 28%),
    linear-gradient(180deg,rgba(7,16,26,.96),rgba(3,8,14,.98));
  font-size:.84rem;
  letter-spacing:.025em;
}
.ccr-news-intel-frame-loading[hidden]{
  display:none !important;
}

/* Schedule is explicitly desktop-only. News Intel remains available wherever
   the admin Invite Friend affordance is rendered. */
@media (max-width:760px){
  body[data-page="home"] .schedule-launch-btn{
    display:none !important;
  }
  body[data-page="home"] .home-footer-invite-tools .home-news-intel-btn{
    width:38px;
    min-width:38px;
    height:38px;
    min-height:38px;
  }
  body[data-page="home"] .home-footer-invite-tools .home-news-intel-icon,
  body[data-page="home"] .home-footer-invite-tools .home-news-intel-icon-svg{
    width:19px;
    height:19px;
  }
  .ccr-news-intel-frame-backdrop{
    display:none;
  }
  .ccr-news-intel-frame-shell{
    top:0;
    left:0;
    right:0;
    bottom:0;
    width:100vw;
    height:100dvh;
    margin:0;
    border:0;
    border-radius:0;
  }
  .ccr-news-intel-frame-head{
    min-height:50px;
    padding:max(8px,env(safe-area-inset-top,0px)) max(10px,env(safe-area-inset-right,0px)) 8px max(13px,env(safe-area-inset-left,0px));
  }
  .ccr-news-intel-frame-titlewrap p{
    font-size:.57rem;
  }
  .ccr-news-intel-frame-titlewrap h2{
    font-size:.96rem;
  }
}

@media (prefers-reduced-motion:reduce){
  body[data-page="home"] .home-news-intel-btn{
    transition:none !important;
  }
}
/* ===== S56N R1 — News Intel / Schedule navigation — END ===== */

/* ===== S56R R1 — narrowly scoped visual repairs ===== */
/* Mobile initials/account badge must never leak into the desktop title. */
@media (min-width:761px){
  body[data-page="home"] .site-title-mobile-user-badge{
    display:none !important;
  }
}

/* Study & Research book-summary prose is body/secondary copy, not an accent label. */
body[data-page="home"] .book-shell-card-item__brief-review,
body[data-page="home"] .book-shell-card-item__head p.book-shell-card-item__brief-review{
  color:var(--text-2, rgba(194,204,214,.92)) !important;
}

/* ===== S56S R1 — Change BG + contrast calibration ===== */
/* Background environmental dimming: use the existing wash layer so foreground UI,
   RSS images, charts and overlays are never darkened by the background adjustment. */
body[data-page="home"] .site-world-map-wash{
  background-color:rgba(2,6,10,var(--ccr-ui-background-dim)) !important;
}

/* First-wave semantic neutral-text mapping. Existing Appearance colour/brightness
   settings remain authoritative inputs; S56S adds only the shared perceptual lift. */
body[data-page="home"] .top-card h3,
body[data-page="home"] .intel-card__headline{
  color:var(--ccr-ui-text-primary-source) !important;
  filter:brightness(var(--ccr-card-headline-brightness,100%)) brightness(var(--ccr-ui-text-lift-primary)) !important;
}
body[data-page="home"] .latest-items-title,
body[data-page="home"] .section-title-row h2,
body[data-page="home"] .hero-card h2,
body[data-page="home"] .section-header h2{
  filter:brightness(var(--ccr-section-subheads-brightness,100%)) brightness(var(--ccr-ui-text-lift-primary)) !important;
}
body[data-page="home"] .body-copy,
body[data-page="home"] .body-copy p{
  color:var(--ccr-ui-text-body-source) !important;
  filter:brightness(var(--ccr-body-text-brightness,100%)) brightness(var(--ccr-ui-text-lift-body)) !important;
}
body[data-page="home"] .summary-copy,
body[data-page="home"] .summary-copy p{
  filter:brightness(var(--ccr-summary-text-brightness,100%)) brightness(var(--ccr-ui-text-lift-body)) !important;
}
body[data-page="home"] .meta-date,
body[data-page="home"] .filter-group label,
body[data-page="home"] .filter-note,
body[data-page="home"] .about-site-panel,
body[data-page="home"] .about-site-panel p,
body[data-page="home"] .empty-state,
body[data-page="home"] .helper{
  filter:brightness(var(--ccr-ui-text-lift-muted)) !important;
}

/* CCR Intelligence cards use their own card grammar outside Appearance's generic
   body-copy selectors, so map those neutral text roles explicitly. */
body[data-page="home"] .ccr-intelligence-ribbon__rss-body h3 button,
body[data-page="home"] .ccr-intelligence-ribbon__ccr-body h3 button{
  filter:brightness(var(--ccr-ui-text-lift-primary)) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-body > p,
body[data-page="home"] .ccr-intelligence-ribbon__ccr-body > p{
  filter:brightness(var(--ccr-ui-text-lift-body)) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-meta,
body[data-page="home"] .ccr-intelligence-ribbon__ccr-meta{
  filter:brightness(var(--ccr-ui-text-lift-muted)) !important;
}

/* Market chart cards: lift neutral values/copy only. Directional red/green <em>
   values are intentionally excluded so semantic market-state colouring is preserved. */
body[data-page="home"] .ticker-chart-card__value-row > span,
body[data-page="home"] .ticker-chart-card__button > p{
  filter:brightness(var(--ccr-ui-text-lift-body)) !important;
}

/* Study & Research prose is neutral body text; gold remains reserved for accents. */
body[data-page="home"] .book-shell-card-item__brief-review,
body[data-page="home"] .book-shell-card-item__head p.book-shell-card-item__brief-review{
  color:var(--ccr-ui-text-body-source) !important;
  filter:brightness(var(--ccr-ui-text-lift-body)) !important;
}

/* Desktop-only Change BG utility. It deliberately lives with Invite Friend rather
   than in the header/mobile navigation. Comprehensive !important declarations guard
   it from the ribbon's generic search-button rules. */
body[data-page="home"] .home-change-bg-btn[hidden]{display:none !important}
@media (min-width:761px){
  body[data-page="home"] .ccr-intelligence-ribbon__search .home-change-bg-btn{
    appearance:none !important;
    box-sizing:border-box !important;
    flex:0 0 auto !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    min-width:auto !important;
    width:auto !important;
    min-height:28px !important;
    height:28px !important;
    padding:3px 10px !important;
    border:1px solid rgba(233,202,136,.14) !important;
    border-radius:999px !important;
    background:rgba(233,202,136,.036) !important;
    color:rgba(224,211,177,.76) !important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.045),0 6px 14px rgba(0,0,0,.08) !important;
    font-family:Inter,"Noto Sans JP",system-ui,sans-serif !important;
    font-size:.72rem !important;
    font-weight:700 !important;
    line-height:1 !important;
    letter-spacing:.004em !important;
    text-transform:none !important;
    white-space:nowrap !important;
    cursor:pointer !important;
    transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease,box-shadow .16s ease !important;
  }
  body[data-page="home"] .ccr-intelligence-ribbon__search .home-change-bg-btn:hover,
  body[data-page="home"] .ccr-intelligence-ribbon__search .home-change-bg-btn:focus-visible{
    border-color:rgba(239,218,166,.30) !important;
    background:rgba(233,202,136,.075) !important;
    color:rgba(255,235,181,.92) !important;
    box-shadow:inset 0 1px 0 rgba(255,255,255,.065),0 8px 18px rgba(0,0,0,.12),0 0 9px rgba(232,190,112,.045) !important;
    transform:translateY(-1px) !important;
    outline:none !important;
  }
  body[data-page="home"] .ccr-intelligence-ribbon__search .home-change-bg-btn:active{
    transform:translateY(1px) scale(.97) !important;
  }
}
@media (max-width:760px){
  body[data-page="home"] .home-change-bg-btn{
    display:none !important;
  }
}
@media (prefers-reduced-motion:reduce){
  body[data-page="home"] .home-change-bg-btn{transition:none !important}
}
/* ===== S56S R1 — END ===== */

/* ===== S56Y R1 — RSS tab-card reading contrast =====
   Scope is deliberately limited to RSS cards in the grid directly below the
   intelligence tabs. Search/archive results, CCR cards, metadata and images
   retain their existing hierarchy. */
body[data-page="home"] .ccr-intelligence-ribbon__rss-grid > .ccr-intelligence-ribbon__rss-card .ccr-intelligence-ribbon__rss-body h3{
  color:#f1dfe4 !important;
  color:color-mix(in srgb,var(--ccr-card-headline-color,#e2c3cc) 52%,rgba(255,255,255,1) 48%) !important;
  filter:brightness(var(--ccr-card-headline-brightness,100%)) !important;
  opacity:var(--ccr-card-headline-opacity,1);
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-grid > .ccr-intelligence-ribbon__rss-card .ccr-intelligence-ribbon__rss-body h3 a,
body[data-page="home"] .ccr-intelligence-ribbon__rss-grid > .ccr-intelligence-ribbon__rss-card .ccr-intelligence-ribbon__rss-body h3 button{
  color:inherit !important;
  filter:none !important;
  opacity:1 !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__rss-grid > .ccr-intelligence-ribbon__rss-card .ccr-intelligence-ribbon__rss-body > p{
  color:rgba(240,246,252,.80) !important;
  color:color-mix(in srgb,var(--ccr-card-subtext-color,rgba(233,240,247,.68)) 55%,rgba(255,255,255,.96) 45%) !important;
  filter:brightness(var(--ccr-card-subtext-brightness,100%)) !important;
  opacity:1 !important;
}

@media (max-width:760px){
  body[data-page="home"] .ccr-intelligence-ribbon__rss-grid > .ccr-intelligence-ribbon__rss-card .ccr-intelligence-ribbon__rss-body h3{
    color:#f4e6ea !important;
    color:color-mix(in srgb,var(--ccr-card-headline-color,#e2c3cc) 44%,rgba(255,255,255,1) 56%) !important;
  }
  body[data-page="home"] .ccr-intelligence-ribbon__rss-grid > .ccr-intelligence-ribbon__rss-card .ccr-intelligence-ribbon__rss-body > p{
    color:rgba(242,247,252,.85) !important;
    color:color-mix(in srgb,var(--ccr-card-subtext-color,rgba(233,240,247,.68)) 45%,rgba(255,255,255,.98) 55%) !important;
  }
}
/* ===== S56Y R1 — END ===== */

/* ===== S56Y R3 — Deterministic physical tab overlap =====
   The ribbon supports 40 selected sources plus CCR and the Universe control.
   Normal tabs descend left-to-right so each left tab physically covers its
   right neighbour. Raised interaction states remain above the normal stack. */
body[data-page="home"] .ccr-intelligence-ribbon__tab{
  z-index:var(--ccr-ribbon-tab-stack,2) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(1){--ccr-ribbon-tab-stack:44}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(2){--ccr-ribbon-tab-stack:43}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(3){--ccr-ribbon-tab-stack:42}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(4){--ccr-ribbon-tab-stack:41}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(5){--ccr-ribbon-tab-stack:40}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(6){--ccr-ribbon-tab-stack:39}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(7){--ccr-ribbon-tab-stack:38}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(8){--ccr-ribbon-tab-stack:37}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(9){--ccr-ribbon-tab-stack:36}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(10){--ccr-ribbon-tab-stack:35}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(11){--ccr-ribbon-tab-stack:34}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(12){--ccr-ribbon-tab-stack:33}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(13){--ccr-ribbon-tab-stack:32}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(14){--ccr-ribbon-tab-stack:31}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(15){--ccr-ribbon-tab-stack:30}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(16){--ccr-ribbon-tab-stack:29}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(17){--ccr-ribbon-tab-stack:28}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(18){--ccr-ribbon-tab-stack:27}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(19){--ccr-ribbon-tab-stack:26}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(20){--ccr-ribbon-tab-stack:25}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(21){--ccr-ribbon-tab-stack:24}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(22){--ccr-ribbon-tab-stack:23}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(23){--ccr-ribbon-tab-stack:22}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(24){--ccr-ribbon-tab-stack:21}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(25){--ccr-ribbon-tab-stack:20}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(26){--ccr-ribbon-tab-stack:19}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(27){--ccr-ribbon-tab-stack:18}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(28){--ccr-ribbon-tab-stack:17}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(29){--ccr-ribbon-tab-stack:16}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(30){--ccr-ribbon-tab-stack:15}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(31){--ccr-ribbon-tab-stack:14}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(32){--ccr-ribbon-tab-stack:13}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(33){--ccr-ribbon-tab-stack:12}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(34){--ccr-ribbon-tab-stack:11}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(35){--ccr-ribbon-tab-stack:10}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(36){--ccr-ribbon-tab-stack:9}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(37){--ccr-ribbon-tab-stack:8}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(38){--ccr-ribbon-tab-stack:7}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(39){--ccr-ribbon-tab-stack:6}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(40){--ccr-ribbon-tab-stack:5}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(41){--ccr-ribbon-tab-stack:4}
body[data-page="home"] .ccr-intelligence-ribbon__tab:nth-child(42){--ccr-ribbon-tab-stack:3}

/* The following tab's left edge is physically concealed by its left neighbour.
   Restore the complete outline whenever that tab is raised for interaction. */
body[data-page="home"] .ccr-intelligence-ribbon__tab:not(:first-child):not(.is-active):not(:hover):not(:focus-visible){
  border-left-color:transparent !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab:hover,
body[data-page="home"] .ccr-intelligence-ribbon__tab:focus-visible{
  z-index:64 !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab.is-active{
  z-index:65 !important;
}
/* ===== S56Y R3 — END ===== */

/* ===== S56Y R4 — Internal tab-seam calibration =====
   R3 established the physical left-over-right stack. Soften only the exposed
   right edge inside that stack so it reads as depth rather than a divider.
   The final outer edge and raised interaction outlines remain complete. */
body[data-page="home"] .ccr-intelligence-ribbon__tab:not(:last-child):not(.is-active):not(:hover):not(:focus-visible){
  border-right-color:rgba(var(--ccr-context-tab-edge-rgb),.28) !important;
}
body[data-page="home"] .ccr-intelligence-ribbon__tab.is-active:not(:last-child):not(:hover):not(:focus-visible){
  border-right-color:rgba(235,202,136,.50) !important;
}
/* ===== S56Y R4 — END ===== */

/* ===== S56Y R5 — Search overlay fixed close + independent result scroll =====
   Keep the dialog shell and close control stationary while the complete cached
   result set scrolls inside its own viewport. This additive layer avoids any
   change to the protected core stylesheet or index activation. */
body[data-page="home"] .ccr-ribbon-search-overlay__panel{
  overflow:hidden !important;
  padding:0 !important;
}
body[data-page="home"] .ccr-ribbon-search-overlay__scroll{
  box-sizing:border-box;
  width:100%;
  max-height:min(88vh,980px);
  overflow:auto;
  overscroll-behavior:contain;
  padding:clamp(18px,2.6vw,30px);
  scrollbar-gutter:stable;
}
body[data-page="home"] .ccr-ribbon-search-overlay__scroll::-webkit-scrollbar{
  width:10px;
}
body[data-page="home"] .ccr-ribbon-search-overlay__scroll::-webkit-scrollbar-track{
  background:rgba(255,255,255,.04);
  border-radius:999px;
}
body[data-page="home"] .ccr-ribbon-search-overlay__scroll::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.22);
  border:2px solid rgba(8,14,24,.88);
  border-radius:999px;
}
body[data-page="home"] .ccr-ribbon-search-overlay__close{
  position:absolute;
  top:clamp(18px,2.6vw,30px);
  right:clamp(20px,2.8vw,34px);
  z-index:4;
  box-shadow:0 8px 22px rgba(0,0,0,.30),inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
body[data-page="home"] .ccr-ribbon-search-overlay__head{
  padding-right:58px;
}
/* ===== S56Y R5 — END ===== */

/* ===== S56Y R6 — Persistent overlay research bar =====
   The toolbar belongs to the stationary dialog shell. Only the heading and
   complete result set scroll, leaving both refined search and close controls
   continuously available for future overlay expansion. */
body[data-page="home"] .ccr-ribbon-search-overlay__panel{
  display:flex;
  flex-direction:column;
}
body[data-page="home"] .ccr-ribbon-search-overlay__toolbar{
  position:relative;
  z-index:5;
  flex:0 0 auto;
  display:flex;
  align-items:center;
  gap:12px;
  padding:clamp(14px,1.8vw,20px) clamp(18px,2.6vw,30px);
  border-bottom:1px solid rgba(255,255,255,.085);
  background:linear-gradient(180deg,rgba(18,29,45,.97),rgba(12,21,34,.94));
  box-shadow:0 10px 28px rgba(0,0,0,.16),inset 0 1px 0 rgba(255,255,255,.045);
}
body[data-page="home"] .ccr-ribbon-search-overlay__form{
  flex:1 1 auto;
  min-width:0;
  display:flex;
  align-items:center;
  gap:10px;
}
body[data-page="home"] .ccr-ribbon-search-overlay__input{
  appearance:none;
  -webkit-appearance:none;
  box-sizing:border-box;
  flex:1 1 auto;
  min-width:0;
  height:42px;
  padding:0 14px;
  border:1px solid rgba(183,203,232,.20);
  border-radius:12px;
  outline:none;
  background:rgba(5,12,22,.58);
  color:rgba(247,249,252,.96);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 8px 20px rgba(0,0,0,.12);
  font:600 .90rem/1.2 Inter,"Noto Sans JP",system-ui,sans-serif;
  transition:border-color .16s ease,background .16s ease,box-shadow .16s ease;
}
body[data-page="home"] .ccr-ribbon-search-overlay__input::placeholder{
  color:rgba(210,222,238,.48);
}
body[data-page="home"] .ccr-ribbon-search-overlay__input:hover{
  border-color:rgba(203,219,241,.30);
  background:rgba(7,15,27,.68);
}
body[data-page="home"] .ccr-ribbon-search-overlay__input:focus-visible{
  border-color:rgba(233,202,136,.58);
  background:rgba(7,15,27,.78);
  box-shadow:0 0 0 3px rgba(233,202,136,.10),inset 0 1px 0 rgba(255,255,255,.05);
}
body[data-page="home"] .ccr-ribbon-search-overlay__submit{
  flex:0 0 auto;
  min-height:42px;
  white-space:nowrap;
}
body[data-page="home"] .ccr-ribbon-search-overlay__toolbar .ccr-ribbon-search-overlay__close{
  position:static;
  flex:0 0 auto;
  margin:0;
}
body[data-page="home"] .ccr-ribbon-search-overlay__scroll{
  flex:1 1 auto;
  min-height:0;
  max-height:none;
}
body[data-page="home"] .ccr-ribbon-search-overlay__head{
  padding-right:0;
}
@media (max-width:900px) and (min-width:761px){
  body[data-page="home"] .ccr-ribbon-search-overlay__toolbar{
    gap:9px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__form{
    gap:8px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__input{
    height:40px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__submit{
    min-height:40px;
    padding-inline:14px;
  }
}
/* ===== S56Y R6 — END ===== */

/* ===== S56Y R7 — Search timeframe control + archive continuation =====
   Add one compact native selector to the fixed research toolbar. Short ranges
   filter the loaded cache; month ranges continue through authenticated history
   automatically as the reader approaches the end of the result grid. */
body[data-page="home"] .ccr-ribbon-search-overlay__range-wrap{
  position:relative;
  flex:0 0 auto;
  min-width:154px;
}
body[data-page="home"] .ccr-ribbon-search-overlay__range{
  appearance:auto;
  box-sizing:border-box;
  width:100%;
  height:42px;
  padding:0 34px 0 12px;
  border:1px solid rgba(183,203,232,.20);
  border-radius:12px;
  outline:none;
  background-color:rgba(5,12,22,.58);
  color:rgba(247,249,252,.94);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 8px 20px rgba(0,0,0,.12);
  font:600 .82rem/1.2 Inter,"Noto Sans JP",system-ui,sans-serif;
  color-scheme:dark;
  cursor:pointer;
  transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease;
}
body[data-page="home"] .ccr-ribbon-search-overlay__range:hover{
  border-color:rgba(203,219,241,.30);
  background-color:rgba(7,15,27,.68);
}
body[data-page="home"] .ccr-ribbon-search-overlay__range:focus-visible{
  border-color:rgba(233,202,136,.58);
  background-color:rgba(7,15,27,.78);
  box-shadow:0 0 0 3px rgba(233,202,136,.10),inset 0 1px 0 rgba(255,255,255,.05);
}
body[data-page="home"] .ccr-ribbon-search-overlay__archive-sentinel{
  grid-column:1 / -1;
  min-height:52px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:rgba(216,226,239,.68);
  font:600 .82rem/1.3 Inter,"Noto Sans JP",system-ui,sans-serif;
  letter-spacing:.01em;
}
@media (max-width:900px) and (min-width:761px){
  body[data-page="home"] .ccr-ribbon-search-overlay__range-wrap{
    min-width:142px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__range{
    height:40px;
    padding-left:10px;
    font-size:.78rem;
  }
}
@media (max-width:760px){
  body[data-page="home"] .ccr-ribbon-search-overlay__toolbar{
    align-items:flex-start;
    gap:8px;
    padding:12px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__form{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__input{
    grid-column:1 / -1;
    height:40px;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__range-wrap{
    grid-column:1;
    min-width:0;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__range{
    height:40px;
    padding-left:10px;
    font-size:.78rem;
  }
  body[data-page="home"] .ccr-ribbon-search-overlay__submit{
    grid-column:2;
    min-height:40px;
  }
}
/* ===== S56Y R7 — END ===== */
