@import url('/app-v2.css?v=20261008-ui-v2-4');

/* V3-only presentation refinements. The original and V2 remain unchanged. */
.laboratory-v3 {
  --page-gutter: clamp(8px, 1.25vw, 24px);
  background: radial-gradient(ellipse at 50% 0%, #17384e 0%, #0b2032 60%, #071827 100%);
  background-attachment: fixed;
}
.laboratory-v3 .shell {
  width: calc(100% - var(--page-gutter) - var(--page-gutter));
  max-width: none;
  height: 100dvh;
  min-height: 0;
  padding: clamp(8px, 1.25vh, 18px) 0;
  display: flex;
  flex-direction: column;
}
.laboratory-v3 .topbar { flex-shrink: 0; }
.laboratory-v3 .stage-card { flex: 1; height: auto; min-height: 0; }
.laboratory-v3 .brand-copy {
  --brand-line-size: clamp(18px, 1.75vw, 24px);
  /* One shared measure for both names; do not stretch individual glyphs. */
  width: calc(16.56 * var(--brand-line-size));
  max-width: 100%;
}
.laboratory-v3 .brand .eyebrow,
.laboratory-v3 .brand-copy h1 {
  width: 100%;
  font-size: var(--brand-line-size);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .035em;
  color: #e5f5fb;
  white-space: nowrap;
  text-align: justify;
  text-align-last: justify;
}
.laboratory-v3 .brand .eyebrow { margin-bottom: 5px; }

/* Shift the existing full-height canvas left; retain its stage and grounding. */
.laboratory-v3 .avatar { left: 0; right: auto; width: 62%; }
.laboratory-v3 .chat-panel {
  --caption-font-size: clamp(14px, 1.15vw, 17px);
  --caption-line-height: calc(var(--caption-font-size) * 1.85);
  top: 25px;
  bottom: 23px;
  height: auto;
  min-height: 0;
  width: calc(46% - 17px);
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  background: linear-gradient(155deg, rgba(8,39,61,.16), rgba(5,27,46,.22));
  box-shadow: 0 12px 36px rgba(2,19,32,.09), inset 0 1px rgba(255,255,255,.05);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.laboratory-v3 .avatar-panel::before {
  background-image: url('/assets/brand/company-laboratory-v3-20261010.jpg');
  filter: saturate(.84) brightness(1.16);
}
.laboratory-v3 .avatar-panel::after {
  background: linear-gradient(90deg, rgba(20,43,63,.07), rgba(25,52,70,.01) 40%, rgba(8,33,52,.09));
}
.laboratory-v3 .scene-vignette {
  background: linear-gradient(to top, rgba(17,38,53,.18), transparent 24%);
  box-shadow: inset 0 0 60px rgba(15,32,44,.025);
}
.laboratory-v3 .message p {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: var(--caption-font-size);
  line-height: var(--caption-line-height);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
  text-shadow: 0 1px 3px rgba(0,15,28,.72);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.laboratory-v3 .answer-bubble {
  padding: 12px 15px;
  border: 1px solid rgba(184,225,244,.16);
  border-radius: 4px 16px 16px 16px;
  background: rgba(8,35,55,.29);
}
.laboratory-v3 .message.user p {
  padding: 12px 15px;
  border: 1px solid rgba(184,225,244,.16);
  border-radius: 16px 4px 16px 16px;
  background: rgba(13,112,159,.46);
}
.laboratory-v3 .composer {
  background: rgba(2,18,31,.43);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.laboratory-v3 .suggestions button {
  background: rgba(8,35,55,.34);
  text-shadow: 0 1px 3px rgba(0,15,28,.65);
}
.laboratory-v3 textarea::placeholder { color: #d0e4ed; }

/* The conversation frame keeps its normal height. Only the text viewport
   inside each answer bubble is capped at three physical lines. */
.laboratory-v3 .messages {
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 2px 3px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  mask-image: none;
}
.laboratory-v3 .answer-viewport {
  box-sizing: content-box;
  max-height: calc(var(--caption-line-height) * 3);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  scroll-behavior: auto;
}
.laboratory-v3 .message {
  display: flex;
  margin: 0 0 16px;
  animation: none;
}
.laboratory-v3 .message > div { flex: 1; max-width: calc(100% - 48px); min-width: 0; }
.laboratory-v3 .message[hidden] { display: none; }
.laboratory-v3 .message p.reading-answer { position: relative; isolation: isolate; }
.laboratory-v3 .message p.reading-answer.is-reading::before {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  left: 0;
  right: 0;
  top: var(--reading-line-top, 0px);
  height: var(--reading-line-height, 22px);
  border-radius: 4px;
  background: rgba(83, 219, 244, .16);
  box-shadow: inset 2px 0 rgba(129, 237, 255, .6);
}

.memory-dialog { box-sizing: border-box; width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 1px solid #5d859c; border-radius: 18px; color: #e5f5fb; background: #102c40; box-shadow: 0 20px 80px #0008; }
.memory-dialog::backdrop { background: #03111dc4; }
.memory-dialog [hidden] { display: none; }
.memory-dialog p { line-height: 1.7; overflow-wrap: anywhere; }
.memory-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.memory-heading h2, .memory-project h3 { margin: 0; }
.memory-dialog button { padding: 9px 13px; border: 1px solid #6b9db5; border-radius: 8px; color: #effaff; background: #155678; cursor: pointer; }
.memory-dialog button:disabled { opacity: .55; cursor: wait; }
.memory-dialog input { box-sizing: border-box; width: 100%; margin-top: 7px; padding: 10px; border: 1px solid #7499ad; border-radius: 8px; background: #081f30; color: #effaff; }
.memory-dialog :focus-visible { outline: 2px solid #8ce9ff; outline-offset: 3px; }
.memory-form { display: grid; gap: 12px; margin: 20px 0; }
.memory-form label { display: block; }
.memory-projects { display: grid; gap: 12px; margin-bottom: 20px; }
.memory-project { min-width: 0; padding: 16px; border: 1px solid #446c83; border-radius: 12px; background: #0a2335; }
.memory-summary { white-space: pre-wrap; }
.memory-updated, .memory-empty { color: #c0d6e3; }
.memory-project-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.memory-dialog .memory-delete { color: #ffd0cf; border-color: #b27178; background: #592d3b; }
.memory-status { min-height: 1.7em; margin-bottom: 0; }

@media (max-width: 1100px) and (min-width: 701px) {
  .laboratory-v3 .topbar { flex-wrap: wrap; gap: 12px 18px; }
  .laboratory-v3 .brand-copy { --brand-line-size: clamp(16px, 1.9vw, 20px); }
  .laboratory-v3 .top-actions { margin-left: auto; }
  .laboratory-v3 .avatar { left: -2%; width: 62%; }
  .laboratory-v3 .chat-panel { top: 18px; bottom: 23px; width: calc(47% - 11px); }
}
@media (max-width: 700px) {
  .laboratory-v3 .top-actions { flex-wrap: wrap; }
  .laboratory-v3 .brand-copy { --brand-line-size: clamp(10px, 3.05vw, 18px); }
  .laboratory-v3 .brand .eyebrow { margin-bottom: 4px; }
  .laboratory-v3 .stage-card { min-height: 0; }
  .laboratory-v3 .avatar { left: 0; right: auto; width: 100%; }
  .laboratory-v3 .chat-panel {
    --caption-font-size: 14px;
    left: 10px;
    right: 10px;
    top: 12px;
    bottom: 96px;
    height: auto;
    min-height: 0;
    width: auto;
    grid-template-rows: minmax(0, 1fr) auto auto;
    background: linear-gradient(155deg, rgba(8,39,61,.27), rgba(5,27,46,.37));
    box-shadow: 0 12px 32px rgba(2,19,32,.16);
  }
  .laboratory-v3 .answer-bubble { background: rgba(8,35,55,.36); }
  .laboratory-v3 .welcome-message p { white-space: pre-wrap; }
}
