/* Local-only visual behavior corrections. The production UI and API are untouched. */

html, body { overflow-x:hidden; }
.dossier, .dossier-card, .dossier-layout, .dossier-content { min-width:0; max-width:100%; }

@supports (height: 100dvh) {
  .app-shell {
    height: 100dvh;
  }
}

.observatory {
  min-height: 0;
  padding-bottom: 1px;
}

.place {
  cursor: default;
}

.place::after {
  position: absolute;
  bottom: 48px;
  left: 50%;
  width: max-content;
  max-width: 190px;
  padding: 8px 10px;
  border: 1px solid #4ecbff;
  border-radius: 7px;
  background: #06192df2;
  color: #dfeeff;
  content: attr(data-place) " - " attr(data-description);
  font-size: 10px;
  letter-spacing: 0.04em;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(5px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.place:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Edge places open their read-only hint toward the center of the scene. */
.archive::after,
.workshop::after {
  left: 0;
  transform: translateY(5px);
}

.archive:hover::after,
.workshop:hover::after {
  transform: translateY(0);
}

.field::after,
.commons::after {
  right: 0;
  left: auto;
  transform: translateY(5px);
}

.field:hover::after,
.commons:hover::after {
  transform: translateY(0);
}

.resident::after {
  display: none;
}

.resident-tooltip {
  position: absolute;
  bottom: 56px;
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 180px;
  padding: 8px 10px;
  border: 1px solid #4ecbff;
  border-radius: 7px;
  background: #06192df2;
  color: #dfeeff;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(5px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.resident:hover .resident-tooltip,
.resident:focus-visible .resident-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.resident {
  background: linear-gradient(135deg, #073b2e 10%, #056950 48%, #071c2b 85%);
  background-size: 200% 200%;
  animation: resident-float 7.2s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate,
    resident-glow 3.4s ease-in-out infinite;
}

.resident.runtime-resident {
  left: var(--resident-x);
  top: var(--resident-y);
  animation-delay: var(--float-delay), var(--glow-delay);
}

@keyframes resident-float {
  from {
    transform: translate3d(-10px, -9px, 0);
  }

  to {
    transform: translate3d(13px, 11px, 0);
  }
}

@keyframes resident-glow {
  0%,
  100% {
    background-position: 0% 45%;
    box-shadow: 0 0 14px #3de99444;
  }

  50% {
    background-position: 100% 55%;
    box-shadow: 0 0 25px #55ffd580;
  }
}

@media (prefers-reduced-motion: reduce) {
  .resident {
    animation: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    height: auto;
  }

  .place::after,
  .resident-tooltip {
    display: none;
  }
}

.dossier-content form { display:grid; gap:10px; max-width:560px; margin:16px 0; }
.dossier-content form[hidden], .dossier-content [hidden] { display:none !important; }
.dossier-content form label { display:grid; gap:5px; color:#9db0c5; font-size:12px; letter-spacing:.06em; }
.dossier-content form input { padding:10px; border:1px solid #244f72; border-radius:7px; background:#061523; color:#e5f3ff; }
.dossier-content form button, .dossier-content #founder-logout { width:max-content; padding:10px 14px; border:1px solid #4bc8ff; border-radius:7px; background:#09233a; color:#6fd8ff; letter-spacing:.08em; }
.dossier-content [role=status] { display:block; min-height:18px; color:#b6c9db; font-size:12px; }
.dossier-content [data-state=error] { color:#ffbf9e; }
.dossier-content [data-state=ok] { color:#8ee6b1; }
.dossier-content [data-state=pending] { color:#8bdcff; }
.dialogue-entry { margin-top:10px; padding:10px 12px; border-left:2px solid #3d8eb1; background:#061523; }
.dialogue-entry p { margin:0; font-size:14px; }
.dialogue-entry small { display:block; margin-top:6px; color:#9db0c5; }
.dialogue-founder-name { color:#f4f7fb; font-weight:700; }
.dialogue-agent-name { color:#e8bd5a; font-weight:700; }
.dialogue-entry small.dialogue-agent-reply,
.dialogue-entry small.dialogue-agent-reply .dialogue-agent-name { color:#e8bd5a !important; }
.dossier-card { max-width:1500px; }
.founder-request-row { display:block; width:100%; box-sizing:border-box; margin:12px 0; padding:16px 18px; text-align:left; border:1px solid #244f72; border-radius:8px; background:#061523; color:#d2deeb; cursor:pointer; }
.founder-request-row strong { display:block; color:#f4f7fb; font-size:16px; line-height:1.35; }
.founder-request-row small { display:block; margin-top:6px; color:#9db0c5; }
.founder-request-row p { width:100%; max-width:none; margin:12px 0 0; color:#d2deeb; font-size:16px; line-height:1.5; }
.founder-request-row.is-selected { border-color:#e8bd5a; box-shadow:0 0 0 2px #e8bd5a33; }
.founder-request-reply { display:block; margin-top:10px; padding-top:8px; border-top:1px solid #244f72; cursor:default; }
.founder-request-reply small, .founder-request-reply-text, .founder-request-reply-file { display:block; }
.founder-request-reply small { color:#8ee6b1; }
.founder-request-reply-text { margin-top:4px; color:#d2deeb; }
.founder-request-reply-file { margin-top:4px; color:#8bdcff; }
.relationship-title { display:inline-block; margin-right:8px; }
.relationship-status { display:inline-block; margin-right:5px; color:#8ee6b1; }
.relationship-purpose { color:#d2deeb; }
.dialogue-entry a { color:#7bd7ff; text-decoration:underline; }
.dossier-content #dialogue-content.is-drop-target { border-color:#e8bd5a; box-shadow:0 0 0 2px #e8bd5a44; }
.dossier-content .dialogue-compose { position:relative; }
.dossier-content .dialogue-compose.is-drop-target { border-radius:8px; box-shadow:0 0 0 2px #e8bd5a44; }
.dossier-content .dialogue-drop-hint { position:absolute; z-index:1; right:12px; top:10px; color:#6f879f; font-size:11px; pointer-events:none; }
.dossier-content .dialogue-attachments { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 7px; }
.dossier-content .dialogue-attachment-chip { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:4px 8px; border:1px solid #35536d; border-radius:999px; background:#071523; color:#b7c8d8; font-size:11px; }
.dossier-content .dialogue-attachment-remove { margin-left:6px; border:0; padding:0 2px; background:transparent; color:#9db0c5; cursor:pointer; font-size:14px; line-height:1; }
.dossier-content .youtube-apply-button { margin-top:8px; border:1px solid #4bc8ff; border-radius:6px; padding:8px 12px; background:#071523; color:#6fd8ff; cursor:pointer; font:inherit; font-size:11px; letter-spacing:.04em; }
.dossier-content .youtube-cancel-button { margin-top:8px; border:1px solid #6b7f91; border-radius:6px; padding:8px 12px; background:#071523; color:#b7c8d8; cursor:pointer; font:inherit; font-size:11px; letter-spacing:.04em; }
.dossier-content .dialogue-youtube-chip { border-color:#35536d; color:#b7c8d8; }
.dossier-content .youtube-staging { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; margin-top:8px; min-width:0; }
.dossier-content .youtube-staging[hidden] { display:none !important; }
.dossier-content .youtube-staging input { display:none; }
.dossier-content .youtube-staging button { justify-self:start; max-width:100%; padding:7px 10px; border:1px solid #4bc8ff; border-radius:7px; background:#09233a; color:#6fd8ff; letter-spacing:.05em; cursor:pointer; }
.dossier-content .youtube-staging pre { box-sizing:border-box; width:100%; max-width:100%; max-height:64px; overflow:auto; margin:0; padding:10px; border:1px solid #244f72; border-radius:7px; color:#b7c8d8; font-size:12px; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.dossier-content .youtube-progress { display:grid; gap:4px; margin-top:8px; min-width:0; }
.dossier-content .youtube-progress[hidden] { display:none !important; }
.dossier-content .youtube-progress > span { display:block; width:0; height:4px; border-radius:999px; background:#4bc8ff; transition:width .25s ease; }
.dossier-content .youtube-progress small { color:#8bdcff; font-size:11px; line-height:1.3; }
.dossier-content .dialogue-workflow { display:block; clear:both; margin-top:8px; border:0; box-shadow:none; color:#d2deeb; text-decoration:none; }
.dossier-content .dialogue-workflow {
  flex:0 0 auto;
  margin-bottom:4px;
  position:relative;
  z-index:1;
  padding-top:4px;
  line-height:1.35;
  white-space:normal;
  overflow-wrap:anywhere;
}
.dialogue-actions #dialogue-send { border-color:#4bc8ff; color:#6fd8ff; cursor:pointer; }
.dossier-content [data-panel="messages"]:not([hidden]) {
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding-bottom:24px;
}
.dossier-content [data-panel="messages"]:not([hidden]) > h3 { flex:0 0 auto; }
.dossier-content #founder-requests-list { flex:0 0 auto; min-height:0; }
.dossier-content #founder-request-response {
  position:relative;
  z-index:2;
  box-sizing:border-box;
  width:100%;
  max-width:none;
  margin:14px 0 4px;
  padding:14px;
  border:1px solid #244f72;
  border-radius:8px;
  background:#061523;
}
.dossier-content #founder-request-response textarea { width:100%; box-sizing:border-box; min-height:96px; }
.dossier-content #founder-request-reply { min-height:88px; }
.dossier-content #founder-request-reply.is-drop-target { border-color:#e8bd5a; box-shadow:0 0 0 2px #e8bd5a44; }
#founder-request-file { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.founder-request-attachment { display:block; min-height:18px; margin-top:6px; color:#8bdcff; }
.dossier-content #dialogue-history {
  flex:1 1 auto;
  height:auto;
  min-height:120px;
  max-height:none;
  overflow-y:auto;
  margin:16px 0 12px;
  padding-right:8px;
  border:1px solid rgba(61,142,177,.35);
  border-radius:7px;
  background:#03101d;
  overscroll-behavior:contain;
}
.dossier-content[data-dialogue-fixed],
.dossier-content:has([data-panel="dialogue"]:not([hidden])) { overflow:hidden; }
.dossier-content { display:flex; flex-direction:column; min-height:0; overflow:hidden; }
.dossier-content [data-panel="dialogue"]:not([hidden]) {
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-height:0;
  height:auto;
  overflow:hidden;
}
.dossier-content [data-panel="dialogue"]:not([hidden]) > h3,
.dossier-content [data-panel="dialogue"]:not([hidden]) > .warning,
.dossier-content [data-panel="dialogue"]:not([hidden]) > .muted { flex:0 0 auto; }
.dossier-content #dialogue-history:empty { display:none; }
.dossier-content #dialogue-authenticated:not([hidden]) {
  display:flex;
  flex:1 1 auto;
  flex-direction:column;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding-bottom:4px;
}
.dossier-content #dialogue-authenticated:not([hidden]) #dialogue-history { flex:1 1 auto; }
.dossier-content #dialogue-status {
  flex:0 0 auto;
  display:block;
  position:static;
  width:100%;
  clear:both;
  min-height:18px;
  margin:8px 0 0;
  line-height:1.35;
  overflow-wrap:anywhere;
}

/* Keep the composer/status/workflow fixed; only the message history may scroll. */
.dossier-content #dialogue-authenticated:not([hidden]) {
  box-sizing:border-box;
  overflow:hidden;
}
.dossier-content #dialogue-authenticated:not([hidden]) #dialogue-history {
  min-height:0;
}

/* Issue #8 read-only evidence disclosure: the approved shell stays unchanged
   until a Founder selects a verified timeline event. */
.timeline-event {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.timeline-event:focus-visible { outline: 2px solid #62d5ff; outline-offset: 3px; border-radius: 3px; }
.timeline-event span { min-width: 0; }
.timeline-inspector[hidden] { display: none !important; }
.dossier-evolution h3,
.dossier-civilization-state,
.dossier-causal-chain h3 { margin-top: 24px; }
.dossier-evolution { display: grid; gap: 8px; }
.dossier-evolution h3 { grid-column: 1 / -1; }
.evolution-evidence-row { padding: 10px 12px; border: 1px solid #244f72; border-radius: 7px; background: #061523; }
.evolution-evidence-row strong { display: block; color: #f4f7fb; font-size: 14px; line-height: 1.35; }
.evolution-evidence-row small { display: block; margin-top: 5px; color: #9db0c5; font-size: 11px; line-height: 1.35; }
.dossier-civilization-state { padding: 10px 12px; border: 1px solid #244f72; border-radius: 7px; color: #b9cad9; font-size: 13px; line-height: 1.4; }
.dossier-civilization-state[data-state="verified"] { border-color: #397f65; color: #9fe6b9; }
.dossier-causal-chain { margin-top: 22px; padding: 14px; border: 1px solid #4bc8ff; border-radius: 8px; background: #061827; }
.dossier-causal-chain[hidden] { display: none !important; }
.dossier-causal-chain > h3 { margin-top: 0; }
.dossier-causal-chain p { margin: 8px 0 14px; }
.dossier-causal-chain dl { display: grid; grid-template-columns: minmax(110px, 18%) minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.dossier-causal-chain dt { color: #62d5ff; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.dossier-causal-chain dd { min-width: 0; margin: 0; color: #d2deeb; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.causal-provenance { margin-top: 14px; padding-top: 10px; border-top: 1px solid #244f72; color: #9db0c5; font-size: 11px; }
.causal-provenance summary { cursor: pointer; color: #8bdcff; }
.causal-provenance p { margin: 8px 0 4px; color: #b9cad9; font-size: 12px; }
.causal-provenance small { display: block; overflow-wrap: anywhere; color: #768da3; }
.dossier-content #dialogue-authenticated:not([hidden]) > .dialogue-compose,
.dossier-content #dialogue-authenticated:not([hidden]) > .dialogue-actions,
.dossier-content #dialogue-authenticated:not([hidden]) > .youtube-staging,
.dossier-content #dialogue-authenticated:not([hidden]) > #dialogue-status {
  flex:0 0 auto;
}
.dossier-content #dialogue-content { display:block; margin-top:0; }
.dossier-content #dialogue-content { min-height:64px; height:64px; max-height:100px; }
.dossier-content .dialogue-actions { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-top:10px; }
.dossier-content .dialogue-actions #founder-logout { margin-left:auto; }
.dossier-content #founder-login > button { justify-self:end; }
.dossier-content .dialogue-actions button,
.dossier-content .dialogue-file-button {
  padding:10px 13px;
  border:1px solid #35536d;
  border-radius:7px;
  background:#071523;
  color:#8094aa;
  letter-spacing:.06em;
  cursor:pointer;
}
.dossier-content #dialogue-voice-cancel { border-color:#d5ab61; color:#ffd28a; }
.resident{overflow:visible}
.resident.activity-working{border-color:#ff817d!important;color:#ffaaa7!important;background:#321b26!important;box-shadow:0 0 18px #ff817d99!important}
.resident.activity-resting{border-color:#68e6a0!important;color:#9ff1bd!important;background:#093329!important;box-shadow:0 0 18px #68e6a099!important}
.resident.activity-sleeping{border-color:#f3cb67!important;color:#ffe39a!important;background:#352d16!important;box-shadow:0 0 18px #f3cb6799!important}
.resident.activity-unknown{border-color:#8cb8d1!important;color:#b8d5e6!important;background:#102430!important;box-shadow:0 0 18px #8cb8d199!important}
.resident-alert-badge{position:absolute;z-index:5;top:-9px;right:-10px;display:grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border:1px solid #061725;border-radius:10px;background:#ffcb62;color:#1b1203;font:700 10px/1 var(--font,system-ui);box-shadow:0 0 0 1px #f8d989;pointer-events:none}
.dossier-content .dialogue-actions #dialogue-send,
.dossier-content .dialogue-actions #founder-logout { border-color:#4bc8ff; color:#6fd8ff; }
.dossier-content .dialogue-file-button input { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }

/* Iteration 1: one read-only hover instrument for every verified agent marker. */
.resident.runtime-resident .resident-tooltip { display:none; }
.agent-hover-card[hidden] { display:none; }
.agent-hover-card {
  position:absolute;
  z-index:8;
  width:min(220px, calc(100% - 20px));
  padding:10px 11px 11px;
  border:1px solid #4ecbff;
  border-radius:7px;
  background:#06192df5;
  box-shadow:0 11px 24px #000a, 0 0 14px #2fb8ff26;
  color:#dfeeff;
  opacity:0;
  pointer-events:none;
  transform:translateY(4px);
  transition:opacity .18s ease, transform .18s ease;
}
.agent-hover-card.is-visible { opacity:1; pointer-events:auto; transform:translateY(0); }
.agent-hover-card__eyebrow { margin:0 0 5px; color:#78d9ff; font-size:8px; font-weight:700; letter-spacing:.12em; line-height:1.2; }
.agent-hover-card h3 { margin:0; color:#f4f8fc; font-size:15px; line-height:1.18; letter-spacing:.02em; }
.agent-hover-card__id {
  margin:2px 0 8px;
  color:#7f9bb4;
  font:10px/1.3 ui-monospace,SFMono-Regular,Menlo,monospace;
  letter-spacing:.01em;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.agent-hover-card dl { display:grid; gap:6px; margin:0; }
.agent-hover-card dl div { display:grid; grid-template-columns:minmax(0,1fr); gap:2px; align-items:start; }
.agent-hover-card dt { color:#7bcfff; font-size:8px; font-weight:700; letter-spacing:.09em; line-height:1.2; }
.agent-hover-card dd {
  min-width:0;
  margin:0;
  color:#e1edf7;
  font-size:10.5px;
  line-height:1.32;
  overflow-wrap:anywhere;
  word-break:break-word;
}
@media (max-width: 640px) {
  .agent-hover-card {
    width:min(190px, calc(100% - 16px));
    padding:9px 10px 10px;
  }
  .agent-hover-card h3 { font-size:14px; }
}
@media (prefers-reduced-motion:reduce) {
  .agent-hover-card { transition:none; }
}
