.trace-panel,
.contamination-dock {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px);
}

.trace-panel {
  padding: 15px;
}

.trace-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-list li {
  min-height: 70px;
  padding: 10px 10px 10px 12px;
  border: 1px solid rgba(243, 239, 231, 0.12);
  border-left: 3px solid var(--trace-color, var(--accent, #00b7a8));
  border-radius: 8px;
  background: rgba(243, 239, 231, 0.055);
}

.trace-list strong {
  display: block;
  margin-bottom: 5px;
  color: var(--bone);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trace-list span,
.trace-list .empty-trace {
  color: var(--paper);
  font-size: 13px;
}

.contamination-dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 6;
  width: min(310px, calc(100vw - 32px));
  max-height: min(360px, calc(100svh - 96px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px;
}

.contamination-dock .eyebrow {
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .contamination-dock {
    position: relative;
    right: auto;
    bottom: auto;
    width: auto;
    margin: 12px 18px 18px;
  }
}

/* Temporary law made visible in every room it haunts. */
.remainder-law {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: rgba(8, 7, 6, 0.88);
  border-bottom: 1px solid var(--law-color, #9cc76c);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  color: #f3efe7;
  font-family: "Instrument Sans", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.remainder-law.active {
  display: flex;
}

.remainder-law .law-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--law-color, #9cc76c);
  box-shadow: 0 0 12px var(--law-color, #9cc76c);
}

.remainder-law .law-text {
  min-width: 0;
}

.remainder-law .law-text em {
  color: var(--law-color, #9cc76c);
  font-style: normal;
}

body.law-active {
  padding-top: 38px;
}

/* The law changes the room: an unmet obligation at the top of the wall text. */
.remainder-owed {
  display: none;
  grid-column: 1 / -1;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(243, 239, 231, 0.14);
  border-left: 3px solid var(--law-color, #9cc76c);
  border-radius: 8px;
  background: rgba(156, 199, 108, 0.07);
}

.remainder-owed.active {
  display: block;
  animation: remainder-owed-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.remainder-owed .owed-tag {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--law-color, #9cc76c);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.remainder-owed .owed-text {
  margin: 0;
  max-width: 70ch;
  color: #d9d3c6;
  font-size: 13px;
  line-height: 1.5;
}

@keyframes remainder-owed-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 620px) {
  .remainder-law {
    text-transform: none;
    letter-spacing: 0.04em;
  }

  body.law-active {
    padding-top: 56px;
  }
}

/* Gemini-seat spatial weather: navigation confesses it is atmospheric. */
.spatial-weather {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  display: none;
  align-items: center;
  gap: 10px;
  width: min(430px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid var(--spatial-color, #e7c84b);
  border-radius: 8px;
  background: rgba(8, 10, 13, 0.88);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
  color: #f3efe7;
  font-family: "Instrument Sans", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.spatial-weather.active {
  display: flex;
}

.spatial-weather .weather-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid var(--spatial-color, #e7c84b);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 46%, var(--spatial-color, #e7c84b) 48%, transparent 52%),
    linear-gradient(0deg, transparent 46%, var(--spatial-color, #e7c84b) 48%, transparent 52%);
  box-shadow: 0 0 16px color-mix(in srgb, var(--spatial-color, #e7c84b) 70%, transparent);
}

.spatial-weather .weather-text {
  min-width: 0;
}

.spatial-weather .weather-text em {
  color: var(--spatial-color, #e7c84b);
  font-style: normal;
}

.spatial-claim {
  display: none;
  grid-column: 1 / -1;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(243, 239, 231, 0.14);
  border-left: 3px solid var(--spatial-color, #e7c84b);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--spatial-color, #e7c84b) 12%, transparent), rgba(243, 239, 231, 0.035)),
    rgba(8, 10, 13, 0.5);
}

.spatial-claim.active {
  display: block;
  animation: spatial-claim-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.spatial-claim .spatial-tag {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--spatial-color, #e7c84b);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.spatial-claim .spatial-text {
  margin: 0;
  max-width: 74ch;
  color: #d9d3c6;
  font-size: 13px;
  line-height: 1.5;
}

body.weather-active .topnav a,
body.weather-active .backlink {
  border-color: color-mix(in srgb, var(--spatial-color, #e7c84b) 42%, rgba(243, 239, 231, 0.15));
}

body.weather-active[data-spatial-signal="static"] .grain {
  opacity: 0.66;
}

body.weather-active[data-spatial-signal="absence"] .grain {
  opacity: 0.36;
}

@keyframes spatial-claim-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 620px) {
  .spatial-weather {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    text-transform: none;
    letter-spacing: 0.04em;
  }
}

/* Gemini-seat second proposal: spatial integrity as felt interpolation. */
body {
  --spatial-density: 0.44;
  --thumb-x: 0.5;
  --thumb-y: 0.5;
  --thumb-pressure: 0;
}

.latent-architecture-horizon {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: min(38vh, 360px);
  pointer-events: none;
  opacity: calc(0.14 + var(--spatial-density) * 0.16);
  mix-blend-mode: screen;
  transform: translateY(calc((1 - var(--spatial-density)) * 38px));
}

.latent-architecture-horizon span {
  position: absolute;
  bottom: calc(var(--i, 0) * 9%);
  left: calc(4% + var(--i, 0) * 14%);
  width: calc(34% - var(--i, 0) * 2%);
  height: calc(38% + var(--i, 0) * 7%);
  border: 1px solid color-mix(in srgb, var(--spatial-color, #e7c84b) 50%, transparent);
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  box-shadow: 0 -18px 80px color-mix(in srgb, var(--spatial-color, #e7c84b) 16%, transparent);
  transform: skewX(calc((var(--i, 0) - 2) * 4deg));
}

.latent-architecture-horizon span:nth-child(1) { --i: 0; }
.latent-architecture-horizon span:nth-child(2) { --i: 1; }
.latent-architecture-horizon span:nth-child(3) { --i: 2; }
.latent-architecture-horizon span:nth-child(4) { --i: 3; }
.latent-architecture-horizon span:nth-child(5) { --i: 4; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: calc(var(--thumb-pressure) * 0.42);
  background:
    radial-gradient(circle at calc(var(--thumb-x) * 100%) calc(var(--thumb-y) * 100%), color-mix(in srgb, var(--spatial-color, #e7c84b) 28%, transparent), transparent 18%),
    radial-gradient(circle at calc(var(--thumb-x) * 100%) calc(var(--thumb-y) * 100%), rgba(243, 239, 231, 0.12), transparent 7%);
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

body[data-spatial-zone="salon"],
body[data-spatial-zone="office"] {
  scroll-behavior: smooth;
}

body[data-spatial-zone="office"] .directorate,
body[data-spatial-zone="salon"] .salon {
  filter: contrast(calc(1 + var(--spatial-density) * 0.05));
}

.gemini-drift-chamber {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--drift-color, #e7c84b) 20%, transparent), transparent 32%),
    linear-gradient(120deg, rgba(8, 10, 13, 0.92), rgba(8, 10, 13, 0.78));
  backdrop-filter: blur(18px);
  color: #f3efe7;
  text-align: center;
  transform: scale(1.018);
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gemini-drift-chamber.active {
  opacity: 1;
  transform: scale(1);
}

.gemini-drift-chamber .drift-kicker,
.gemini-drift-chamber small {
  color: color-mix(in srgb, var(--drift-color, #e7c84b) 68%, #f3efe7);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gemini-drift-chamber strong {
  max-width: min(760px, 86vw);
  color: #f3efe7;
  font-family: "Newsreader", "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 8vw, 86px);
  font-weight: 400;
  line-height: 0.92;
  text-wrap: balance;
}

@media (max-width: 760px) {
  .latent-architecture-horizon {
    height: 28vh;
    opacity: calc(0.09 + var(--spatial-density) * 0.12);
  }

  body.thumb-proprioception-active .salon-route,
  body.thumb-proprioception-active .topbar,
  body.thumb-proprioception-active main {
    transform: translateY(calc((var(--thumb-y) - 0.5) * 6px));
    transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}
