/* =========================================================
   Product window mock + in-page demos
   Product surfaces use the app's real matte tokens.
   ========================================================= */

.window {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(20, 27, 36, 0.22);
  background: var(--canvas);
  color: var(--canvas-text);
  font-family: var(--sans);
  text-align: left;
}

.window-chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid #d8dde3;
  background: #e9ecf0;
}

.traffic {
  display: flex;
  gap: 6px;
  flex: none;
  padding-right: 2px;
}

.traffic span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  background: #ff5f57;
}

.traffic span:nth-child(2) { background: #febc2e; }
.traffic span:nth-child(3) { background: #28c840; }

.tabstrip {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  min-width: 0;
  height: 100%;
  padding-top: 8px;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  min-width: 0;
  max-width: 210px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  color: #5b6677;
  font-size: 10px;
  white-space: nowrap;
}

.tab.is-active {
  background: var(--canvas);
  border-color: #d8dde3;
  color: #253044;
  font-weight: 550;
}

.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-favicon {
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 3px;
  background: linear-gradient(135deg, #7f99b4, #2a9dee);
}

.tab-favicon.alt { background: linear-gradient(135deg, #e7dac6, #9c8660); }

.tab-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  margin-left: auto;
  border-radius: 3px;
  color: #8a93a2;
}

.tab-x .icon { width: 8px; height: 8px; }

.tab-plus {
  width: 26px;
  justify-content: center;
  padding: 0;
  color: #8a93a2;
}

.tab-plus .icon { width: 11px; height: 11px; }

.tab-mask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #353b46;
  color: #cfd5df;
}

.tab-mask .icon { width: 8px; height: 8px; }

.win-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex: none;
}

.win-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #7a8493;
}

.win-action .icon { width: 12px; height: 12px; }

.win-action.is-on {
  background: #d2deea;
  color: #4e6783;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid var(--canvas-hairline);
  background: var(--canvas-surface);
}

.toolbar-nav {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
}

.toolbar-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #5b6677;
}

.toolbar-tool .icon { width: 11px; height: 11px; }
.toolbar-tool.is-muted { color: #b3bac4; }

.addressbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--canvas-hairline);
  border-radius: 6px;
  background: var(--canvas-surface-2);
  color: #5b6677;
  font-size: 10px;
}

.address-lock { width: 10px; height: 10px; color: #8a93a2; }

.address-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.app-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: none;
}

.app-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #5b6677;
}

.app-action .icon { width: 12px; height: 12px; }

.app-action.is-on {
  background: #d2deea;
  color: #4e6783;
  box-shadow: inset 0 0 0 1px rgba(127, 153, 180, 0.45);
}

.app-account {
  border-radius: 50%;
  background: #d2deea;
  color: #4e6783;
  font-size: 8px;
  font-weight: 700;
}

.shield-action {
  gap: 3px;
  width: auto;
  padding: 0 4px;
}

.shield-action .icon { width: 11px; height: 11px; }

.shield-count {
  font-size: 8px;
  font-weight: 650;
  color: #8a93a2;
  font-variant-numeric: tabular-nums;
}

.window-body {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--canvas);
  overflow: hidden;
}

/* ---------- shared page mock ---------- */

.page {
  height: 100%;
  padding: 20px 24px 16px;
  background: #fcfbf8;
  overflow: hidden;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #8a93a2;
  font-size: 8.5px;
}

.page-brand {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 620;
  color: #253044;
  letter-spacing: -0.01em;
}

.page-nav {
  display: flex;
  gap: 11px;
}

.page-pill {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid #e2e6eb;
  border-radius: 999px;
  color: #8a93a2;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-hero {
  margin-top: 15px;
}

.page-kicker {
  color: #8a93a2;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-title {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 520;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: #253044;
}

.page-byline {
  margin-top: 4px;
  color: #5b6677;
  font-size: 9px;
}

.page-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 146px;
  gap: 20px;
  margin-top: 14px;
}

.page-copy p {
  color: #3d4550;
  font-size: 10px;
  line-height: 1.62;
}

.page-copy p + p {
  margin-top: 8px;
}

.page-video {
  margin: 10px 0;
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.video-poster {
  position: relative;
  height: clamp(74px, 9vw, 102px);
  overflow: hidden;
  background: radial-gradient(circle at 32% 38%, rgba(42, 157, 238, 0.55), transparent 44%), radial-gradient(circle at 78% 70%, rgba(231, 218, 198, 0.28), transparent 46%), linear-gradient(135deg, #202a38, #10151c 70%);
}

.poster-orbit {
  position: absolute;
  border: 1px solid rgba(230, 236, 244, 0.18);
  border-radius: 50%;
}

.orbit-a {
  width: 150px;
  height: 150px;
  left: 12%;
  top: -34%;
}

.orbit-b {
  width: 90px;
  height: 90px;
  left: 42%;
  top: 22%;
  border-color: rgba(42, 157, 238, 0.32);
}

.orbit-c {
  width: 240px;
  height: 240px;
  right: -22%;
  top: -70%;
  border-color: rgba(231, 218, 198, 0.14);
}

.poster-play {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(251, 251, 252, 0.94);
  color: #253044;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.poster-play .icon { width: 10px; height: 10px; margin-left: 1px; }

.poster-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(16, 21, 28, 0.72);
  color: #e6e8ec;
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
}

.video-meta strong {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: #253044;
}

.video-meta span {
  display: block;
  margin-top: 1px;
  color: #8a93a2;
  font-size: 7.5px;
}


.page-aside {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-left: 16px;
  border-left: 1px solid #e2e6eb;
  color: #8a93a2;
  font-size: 8px;
}

.aside-label {
  color: #8a93a2;
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.aside-line {
  padding: 2px 0;
  color: #8a93a2;
}

.aside-line.is-on {
  color: #4e6783;
  font-weight: 600;
}

.aside-rule {
  height: 1px;
  margin: 3px 0;
  background: #e2e6eb;
}

.aside-note {
  color: #5b6677;
}

/* ---------- hero scenes ---------- */

.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(14px);
  transition: opacity 0.42s var(--ease-out), transform 0.42s var(--ease-out), visibility 0.42s;
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.hero-window .window-body,
.chat-window .window-body {
  flex: none;
}

.hero-window .window-body {
  height: clamp(320px, 31vw, 392px);
}


/* research mini map inside the hero */

.map-scene {
  display: flex;
  height: 100%;
  background: var(--canvas);
}

.map-rail {
  width: 148px;
  flex: none;
  padding: 14px 10px;
  border-right: 1px solid #e2e6eb;
  background: #f9f9fb;
}

.rail-label {
  color: #8a93a2;
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.rail-row {
  padding: 6px 7px;
  border-radius: 5px;
  color: #5b6677;
  font-size: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-row.is-on {
  background: #f0f4f8;
  color: #4e6783;
  font-weight: 600;
}

.map-area {
  position: relative;
  flex: 1;
  min-width: 0;
  background-color: #f6f7f9;
  background-image: radial-gradient(rgba(37, 48, 68, 0.13) 1px, transparent 1.2px);
  background-size: 18px 18px;
}

.map-toolbar {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #8a93a2;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid #ded0b9;
  border-radius: 999px;
  background: #f6f0e6;
  color: #756348;
  font-size: 7px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.map-chip .icon { width: 8px; height: 8px; }

.mini-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: visible;
}

.mini-edges path {
  fill: none;
  stroke: #98a2b2;
  stroke-width: 1.3;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 4 4;
  animation: dashFlow 2.2s linear infinite;
}

@keyframes dashFlow {
  to { stroke-dashoffset: -16; }
}

.mini-card {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px 7px 12px;
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  background: #fcfcfd;
  box-shadow: 0 1px 2px rgba(24, 32, 46, 0.05), 0 6px 16px rgba(24, 32, 46, 0.06);
}

.mini-card strong {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: #253044;
}

.mini-card > span:last-child {
  color: #8a93a2;
  font-size: 7px;
  white-space: nowrap;
}

.card-stripe {
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #7f99b4;
  opacity: 0.85;
}

.card-stripe.alt { background: #9db6cf; }
.card-stripe.sand { background: #bfa982; }

.card-a { left: 3%; top: 33%; width: 28%; height: 19%; }
.card-b { left: 37%; top: 11%; width: 30%; height: 19%; }
.card-c { left: 37%; top: 55%; width: 30%; height: 19%; }
.card-d { left: 73%; top: 33%; width: 24%; height: 19%; }

.map-minimap {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: 82px;
  height: 52px;
  border: 1px solid #e2e6eb;
  border-radius: 6px;
  background: #fbfbfc;
}

.map-minimap span {
  position: absolute;
  width: 18%;
  height: 14%;
  border-radius: 2px;
  background: #c7cdd6;
}

.map-minimap span:nth-child(1) { left: 8%; top: 40%; }
.map-minimap span:nth-child(2) { left: 38%; top: 22%; }
.map-minimap span:nth-child(3) { left: 38%; top: 62%; }
.map-minimap span:nth-child(4) { left: 70%; top: 40%; }

/* ---------- page skeleton lines ---------- */

.page-lines {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  max-width: 78%;
}

.page-lines span {
  height: 8px;
  border-radius: 3px;
  background: #e9ecf0;
}

.page-lines span:nth-child(2) { width: 94%; }
.page-lines span:nth-child(3) { width: 88%; }
.page-lines span.short { width: 56%; }

.peek-label {
  color: #8a93a2;
  font-size: 7px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- feature mini visuals ---------- */

.mini-browser { padding: 10px 12px; }

.mini-tabs {
  display: flex;
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e6eb;
}

.mini-tabs span {
  width: 44px;
  height: 15px;
  border-radius: 4px 4px 0 0;
  background: #e9ecf0;
  animation: miniTab 6s var(--ease-in-out) infinite;
}

.mini-tabs span.is-on {
  width: 62px;
  background: #d2deea;
  box-shadow: inset 0 -1.5px 0 #7f99b4;
}

.mini-tabs span:nth-child(2) { animation-delay: 0.6s; }
.mini-tabs span:nth-child(3) { animation-delay: 1.2s; }

@keyframes miniTab {
  0%, 60%, 100% { transform: translateY(0); opacity: 1; }
  20%, 40% { transform: translateY(-2px); opacity: 0.7; }
}

.mini-page {
  display: grid;
  gap: 7px;
  padding: 14px 4px 0;
}

.mini-line {
  height: 5px;
  border-radius: 2px;
  background: #e2e6eb;
}

.mini-line.w80 { width: 80%; }
.mini-line.w70 { width: 70%; }
.mini-line.w60 { width: 60%; }

.mini-block {
  height: 48px;
  border-radius: 6px;
  background: linear-gradient(135deg, #dfe5ec, #c9d4df);
}

.mini-search {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid #d4dae1;
  border-radius: 5px;
  background: #fbfbfc;
  color: #5b6677;
  font-size: 7px;
  box-shadow: 0 2px 8px rgba(24, 32, 46, 0.08);
}

.mini-search .icon { width: 8px; height: 8px; }


.mini-map svg {
  position: absolute;
  inset: 14px 16px;
  width: calc(100% - 32px);
  height: calc(100% - 28px);
}

.mini-edge {
  fill: none;
  stroke: #98a2b2;
  stroke-width: 1.3;
  stroke-dasharray: 4 4;
  animation: dashFlow 2.4s linear infinite;
}

.mini-node {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 20px;
  border: 1px solid #e0e5ea;
  border-radius: 4px;
  background: #fcfcfd;
  color: #5b6677;
  font-size: 7px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(24, 32, 46, 0.06);
}

.node-1 { left: 12%; top: 56%; }
.node-2 { left: 39%; top: 24%; }
.node-3 { left: 39%; top: 66%; }
.node-4 { left: 73%; top: 46%; }

.mini-chat {
  padding: 16px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.mini-chat-row {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
}

.mini-chat-row.is-assistant {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 8px 9px;
  border-radius: 7px;
  background: #fbfbfc;
  border: 1px solid #e2e6eb;
}

.mini-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d2deea;
  color: #4e6783;
  font-size: 7px;
  font-weight: 700;
}

.mini-chat-row .mini-line {
  height: 5px;
  width: 40%;
  background: #d2deea;
  border-radius: 2px;
}

.mini-chat-row .mini-line.w70 { width: 55%; }
.mini-chat-row .mini-line.w90 { width: 90%; }
.mini-chat-row .mini-line.w60 { width: 60%; }

.mini-formula {
  padding: 8px 10px;
  border: 1px solid #e2e6eb;
  border-radius: 6px;
  background: #fff;
  color: #253044;
  font-family: var(--serif);
  font-size: 11px;
  text-align: center;
  font-style: italic;
}

.mini-typing {
  display: inline-flex;
  gap: 3px;
  padding-left: 2px;
}

.mini-typing i,
.chat-typing i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8a93a2;
  animation: typingBounce 1.2s infinite;
}

.mini-typing i:nth-child(2),
.chat-typing i:nth-child(2) { animation-delay: 0.15s; }

.mini-typing i:nth-child(3),
.chat-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.mini-privacy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 22px;
  background: #f1f3f6;
}

.mini-shield {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid #d4dae1;
  border-radius: 9px;
  background: #fbfbfc;
  color: #4e6783;
}

.mini-shield .icon { width: 16px; height: 16px; }

.mini-private-bars {
  display: grid;
  gap: 6px;
  width: 62%;
}

.mini-private-bars span {
  height: 6px;
  border-radius: 2px;
  background: #dfe3e8;
}

.mini-private-bars span:nth-child(2) { width: 80%; }

.mini-lock-chip {
  position: absolute;
  right: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid #363b44;
  border-radius: 5px;
  background: #22262d;
  color: #e6e8ec;
  font-size: 7px;
  font-weight: 600;
  animation: lockFloat 5s var(--ease-in-out) infinite;
}

.mini-lock-chip .icon { width: 8px; height: 8px; }

@keyframes lockFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.mini-update {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
}

.mini-update-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #d4dae1;
  border-radius: 50%;
  background: #fbfbfc;
  color: #4e6783;
}

.mini-update-ring .icon {
  width: 17px;
  height: 17px;
  animation: rotate 7s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.mini-update-copy strong {
  display: block;
  font-size: 9px;
  font-weight: 600;
}

.mini-update-copy span {
  display: block;
  color: #8a93a2;
  font-size: 7.5px;
}

.mini-progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  height: 3px;
  border-radius: 2px;
  background: #e2e6eb;
  overflow: hidden;
}

.mini-progress i {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: 2px;
  background: #7f99b4;
  animation: updateProgress 5s var(--ease-in-out) infinite;
}

@keyframes updateProgress {
  0% { width: 8%; }
  55%, 100% { width: 62%; }
}

/* ---------- research canvas ---------- */

.research-stage {
  position: relative;
  min-width: 0;
}

.canvas-frame {
  --draft-label: "AI draft · Unverified";
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(230, 232, 236, 0.14);
  border-radius: 15px;
  background: #16191f;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02);
  font-family: var(--sans);
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 48px;
  flex: none;
  padding: 0 12px;
  border-bottom: 1px solid #2e3238;
  background: #1b1d20;
}

.canvas-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e6e8ec;
}

.canvas-title > .icon { width: 15px; height: 15px; color: #9db6cf; }

.canvas-title strong {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
}

.canvas-title span {
  display: block;
  color: #79818e;
  font-size: 7.5px;
}

.canvas-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.canvas-tool,
.canvas-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 7px;
  border: 1px solid #3a3f47;
  border-radius: 5px;
  background: #22252a;
  color: #a6aebb;
  font-size: 7.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.canvas-tool .icon { width: 10px; height: 10px; color: #9db6cf; }

.canvas-tool:hover,
.canvas-toggle:hover {
  background: #2a2e34;
  color: #e6e8ec;
}

.canvas-toggle[aria-pressed="true"] {
  border-color: #4a4031;
  background: #2d2821;
  color: #c4b08a;
}

.toggle-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #79818e;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.canvas-toggle[aria-pressed="true"] .toggle-dot {
  background: #c4b08a;
  box-shadow: 0 0 0 3px rgba(196, 176, 138, 0.16);
}

.canvas-body {
  display: flex;
  min-height: 0;
  height: 480px;
}

.papers-sidebar {
  width: 148px;
  flex: none;
  padding: 10px 8px;
  border-right: 1px solid #2e3238;
  background: #1b1d20;
  overflow: hidden;
}

.papers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
  color: #a6aebb;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.papers-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 4px;
  background: #22252a;
  color: #79818e;
  font-size: 7px;
  letter-spacing: 0;
}

.papers-search {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  margin-bottom: 7px;
  padding: 0 7px;
  border: 1px solid #2e3238;
  border-radius: 5px;
  background: #22252a;
  color: #79818e;
  font-size: 7.5px;
}

.papers-search .icon { width: 9px; height: 9px; }

.paper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 6px;
  border-radius: 5px;
  color: #a6aebb;
  font-size: 7.5px;
  white-space: nowrap;
}

.paper-row > span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paper-row > span:last-child {
  flex: none;
  color: #6e7787;
  font-size: 6.5px;
  font-variant-numeric: tabular-nums;
}

.paper-row.is-on {
  background: #2a323c;
  color: #9db6cf;
  font-weight: 600;
}

.canvas-surface {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background-color: #161719;
  background-image: radial-gradient(rgba(230, 232, 236, 0.1) 1px, transparent 1.2px);
  background-size: 18px 18px;
}

.canvas-edges {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: #6e7787;
  pointer-events: none;
}

.edge-path,
.edge-flow {
  fill: none;
  stroke-linecap: round;
}

.edge-path {
  stroke: #6e7787;
  stroke-width: 1.4;
  marker-end: none;
}

.edge-path.is-drawn {
  marker-end: url(#edge-arrow);
}

.edge-flow {
  stroke: #a5b8cb;
  stroke-width: 2.4;
  stroke-dasharray: 2 15;
  opacity: 0;
  animation: edgeFlow 1.1s linear infinite;
}

.edge-flow.is-on { opacity: 0.7; }

@keyframes edgeFlow {
  to { stroke-dashoffset: -17; }
}

.canvas-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 12px;
  height: 100%;
  padding: 54px 14px 20px;
}

.paper-node {
  position: relative;
  align-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 76px;
  padding: 9px 10px 6px 13px;
  border: 1px solid #363b44;
  border-radius: 10px;
  background: #23262b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.52s var(--ease-out), transform 0.52s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
  transition-delay: var(--node-delay, 0ms);
}

.paper-node.is-in {
  opacity: 1;
  transform: none;
}

.paper-node:hover {
  border-color: #6e8caa;
  box-shadow: 0 0 0 1px #6e8caa, 0 0 0 5px rgba(110, 140, 170, 0.12), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.paper-node:focus-visible {
  outline: 2px solid #7f99b4;
  outline-offset: 2px;
}

html:not(.js) .paper-node {
  opacity: 1;
  transform: none;
}

.paper-node[data-x="0"][data-y="1"] { grid-column: 1; grid-row: 2; }
.paper-node[data-x="1"][data-y="0"] { grid-column: 2; grid-row: 1; }
.paper-node[data-x="1"][data-y="2"] { grid-column: 2; grid-row: 3; }
.paper-node[data-x="2"][data-y="0"] { grid-column: 3; grid-row: 1; }
.paper-node[data-x="2"][data-y="1"] { grid-column: 3; grid-row: 2; }
.paper-node[data-x="2"][data-y="2"] { grid-column: 3; grid-row: 3; }
.paper-node[data-x="3"][data-y="1"] { grid-column: 4; grid-row: 2; }

.paper-node h3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.005em;
  color: #e6e8ec;
}

.paper-node footer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid #2e3238;
  color: #79818e;
  font-size: 7px;
  white-space: nowrap;
  overflow: hidden;
}

.paper-node footer > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-meta { color: #79818e; flex: none; }
.node-branch { color: #a5b8cb; flex: none; }

.node-stripe {
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #6e8caa;
  opacity: 0.9;
}

.node-stripe.mist { background: #7f99b4; }
.node-stripe.sand { background: #bfa982; }

.node-peek {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 205px;
  padding: 9px 11px;
  border: 1px solid #3a3f47;
  border-radius: 9px;
  background: #1b1d20;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out), visibility 0.2s;
  pointer-events: none;
}

.paper-node[data-y="2"] .node-peek {
  top: auto;
  bottom: calc(100% + 6px);
}

.paper-node:hover .node-peek,
.paper-node:focus-within .node-peek {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.node-peek ul {
  display: grid;
  gap: 4px;
  margin-top: 5px;
}

.node-peek li {
  position: relative;
  padding-left: 9px;
  color: #a6aebb;
  font-size: 8px;
  line-height: 1.4;
}

.node-peek li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #7f99b4;
}

.paper-node .peek-label {
  color: #79818e;
  font-size: 6.5px;
}

.paper-node.has-draft .node-peek::after {
  content: var(--draft-label);
  display: inline-block;
  margin-top: 6px;
  padding: 1px 5px;
  border: 1px dashed #4a4031;
  border-radius: 4px;
  background: #2d2821;
  color: #c4b08a;
  font-size: 6.5px;
  font-weight: 600;
}

.unconnected-trigger {
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 220px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #3a3f47;
  border-radius: 7px;
  background: rgba(27, 29, 32, 0.94);
  color: #a6aebb;
  font-size: 8px;
  font-weight: 550;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.unconnected-trigger em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  margin-left: 4px;
  border-radius: 4px;
  background: #2a2e34;
  color: #9db6cf;
  font-size: 7px;
  font-style: normal;
}

.unconnected-trigger .icon {
  width: 11px;
  height: 11px;
  transition: transform 0.24s var(--ease-out);
}

.unconnected-trigger[aria-expanded="true"] .icon { transform: rotate(45deg); }

.unconnected-panel {
  position: absolute;
  left: 12px;
  top: 48px;
  z-index: 7;
  display: grid;
  gap: 6px;
  width: 320px;
  padding: 8px;
  border: 1px solid #3a3f47;
  border-radius: 9px;
  background: #1b1d20;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
}

.unconnected-panel[hidden] { display: none; }

.unconnected-row {
  padding: 8px 9px;
  border: 1px solid #2e3238;
  border-radius: 6px;
  background: #23262b;
}

.unconnected-row strong {
  display: block;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.35;
  color: #e6e8ec;
}

.unconnected-row span {
  display: block;
  margin-top: 2px;
  color: #79818e;
  font-size: 7px;
}

.canvas-minimap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  width: 108px;
  height: 68px;
  border: 1px solid #3a3f47;
  border-radius: 7px;
  background: #1b1d20;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.canvas-minimap .mm-node {
  position: absolute;
  width: 18%;
  height: 12%;
  border-radius: 2px;
  background: #4a505a;
}

.mm-node.a { left: 9%; top: 44%; }
.mm-node.b { left: 38%; top: 22%; }
.mm-node.c { left: 38%; top: 68%; }
.mm-node.d { left: 60%; top: 22%; }
.mm-node.e { left: 60%; top: 48%; }
.mm-node.f { left: 60%; top: 74%; }
.mm-node.g { left: 82%; top: 48%; }

.canvas-status {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  flex: none;
  padding: 0 12px;
  border-top: 1px solid #2e3238;
  background: #1b1d20;
  color: #6e7787;
  font-size: 7.5px;
  white-space: nowrap;
  overflow: hidden;
}

.status-sep { color: #3a3f47; }


/* ---------- chat demo ---------- */

.chat-window .window-body {
  height: 470px;
}

.chat-body {
  display: flex;
}

.chat-page {
  flex: 1;
  min-width: 0;
  padding: 20px 22px;
  background: #fcfbf8;
  border-right: 1px solid #e2e6eb;
  overflow: hidden;
}

.chat-page .page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-page .page-hero { margin-top: 22px; }

.chat-page-copy {
  margin-top: 16px;
  max-width: 92%;
  color: #5b6677;
  font-size: 9px;
  line-height: 1.6;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  width: 372px;
  flex: none;
  background: var(--canvas-surface);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 48px;
  flex: none;
  padding: 0 13px;
  border-bottom: 1px solid #e2e6eb;
}

.chat-head h3 {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

.chat-model {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: #8a93a2;
  font-size: 7px;
}

.model-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #6f8b72;
}

.chat-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #e2e6eb;
  border-radius: 6px;
  color: #5b6677;
}

.chat-new .icon { width: 11px; height: 11px; }

.chat-transcript {
  flex: 1;
  min-height: 0;
  padding: 13px 13px 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-transcript::-webkit-scrollbar { width: 8px; }
.chat-transcript::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #d4dae1 padding-box;
}

.chat-msg {
  max-width: 88%;
  font-size: 9.5px;
  line-height: 1.55;
}

.chat-msg.is-user {
  margin-left: auto;
  padding: 7px 10px;
  border-radius: 10px 10px 3px 10px;
  background: #d2deea;
  color: #3d4d60;
}

.chat-msg.is-assistant {
  margin-top: 12px;
  max-width: 100%;
  color: #3d4550;
}

.chat-msg.is-idle {
  display: none;
}

.chat-stream {
  min-height: 1.5em;
  white-space: pre-wrap;
}

.chat-stream::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.14em;
  background: currentColor;
  animation: caretBlink 1s steps(1) infinite;
}

.chat-msg.is-done .chat-stream::after { display: none; }

@keyframes caretBlink {
  50% { opacity: 0; }
}

.chat-list {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding-left: 12px;
  list-style: disc;
}

.chat-list[hidden],
.math-block[hidden] {
  display: none;
}

.chat-list li { padding-left: 1px; }

.math-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin-top: 10px;
  padding: 10px 8px;
  border: 1px solid #e2e6eb;
  border-radius: 7px;
  background: #fff;
  color: #253044;
  font-family: var(--serif);
  font-size: 12px;
  font-style: italic;
}

.math-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin: 0 2px;
  font-size: 8.5px;
  line-height: 1.15;
}

.math-frac span:first-child {
  padding: 0 3px 1px;
  border-bottom: 1px solid currentColor;
}

.math-frac span:last-child { padding-top: 1px; }

.chat-code {
  margin-top: 9px;
  border-radius: 7px;
  overflow: hidden;
  background: #1e242c;
  color: #e6e8ec;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(230, 232, 236, 0.1);
  color: #a6aebb;
  font-size: 7px;
}

.code-head span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.code-head .icon { width: 9px; height: 9px; }

.code-copy {
  padding: 1px 5px;
  border: 1px solid rgba(230, 232, 236, 0.18);
  border-radius: 4px;
  color: #a6aebb;
  font-size: 6.5px;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.code-copy:hover {
  color: #e6e8ec;
  border-color: rgba(230, 232, 236, 0.36);
}

.chat-code pre {
  margin: 0;
  padding: 8px 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.6;
}

.chat-close {
  margin-top: 8px;
  color: #5b6677;
  font-size: 9px;
}

.chat-typing {
  display: inline-flex;
  gap: 4px;
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid #e2e6eb;
  border-radius: 9px;
  background: #fbfbfc;
}

.chat-typing[hidden] { display: none; }

.chat-suggestions {
  display: flex;
  gap: 5px;
  padding: 6px 13px;
  flex-wrap: wrap;
}

.chat-suggestion {
  padding: 4px 7px;
  border: 1px solid #e2e6eb;
  border-radius: 999px;
  background: #f1f3f6;
  color: #5b6677;
  font-size: 7.5px;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.chat-suggestion:hover {
  border-color: #cbd9e6;
  background: #f0f4f8;
  color: #4e6783;
}

.chat-composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 32px;
  margin: 6px 13px 12px;
  padding: 0 5px 0 10px;
  border: 1px solid #d4dae1;
  border-radius: 8px;
  background: #fff;
  color: #8a93a2;
  font-size: 8px;
}

.composer-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #d2deea;
  color: #4e6783;
}

.composer-send .icon { width: 11px; height: 11px; }

/* ---------- responsive demo tweaks ---------- */

@media (max-width: 1120px) {
  .hero-window .window-body { height: clamp(330px, 42vw, 420px); }
  .canvas-body { height: 500px; }
}

@media (max-width: 760px) {
  .window-chrome { height: 34px; padding: 0 8px; gap: 7px; }
  .tabstrip { padding-top: 6px; }
  .tab { height: 28px; max-width: 150px; padding: 0 7px; font-size: 9px; }
  .tab-plus { width: 22px; }
  .win-actions { display: none; }
  .toolbar { height: 36px; padding: 0 8px; gap: 5px; }
  .toolbar-nav { display: none; }
  .addressbar { height: 24px; font-size: 9px; padding: 0 7px; }
  .app-actions .app-action:nth-child(2),
  .app-actions .app-action:nth-child(3) { display: none; }

  .hero-window .window-body { height: 330px; }
  .page { padding: 16px 16px 12px; }
  .page-nav { display: none; }
  .page-title { font-size: 24px; }
  .page-body { grid-template-columns: 1fr; gap: 0; }
  .page-aside { display: none; }
  .video-poster { height: 86px; }

  .map-rail { display: none; }
  .map-scene .map-area { border-left: 0; }
  .map-minimap { display: none; }

  .canvas-frame { border-radius: 12px; }
  .canvas-toolbar { height: auto; min-height: 46px; padding: 7px 10px; flex-wrap: wrap; }
  .canvas-title span { display: none; }
  .canvas-tools { width: 100%; justify-content: space-between; }
  .canvas-tool span:last-child { font-size: 7px; }
  .canvas-body { flex-direction: column; height: auto; }
  .papers-sidebar { display: none; }
  .canvas-edges { display: none; }
  .canvas-surface { min-height: 610px; }
  .canvas-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 9px;
    height: auto;
    min-height: 610px;
    padding: 56px 12px 18px;
    align-content: start;
  }
  .paper-node {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 62px;
  }
  .paper-node[data-y="2"] .node-peek { display: none; }
  .node-peek { display: none; }
  .unconnected-trigger { width: 190px; }
  .unconnected-panel { width: min(320px, calc(100% - 24px)); }
  .canvas-minimap { display: none; }
  .canvas-status { font-size: 6.5px; gap: 4px; }
  .canvas-status span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .canvas-status .status-sep:nth-of-type(2),
  .canvas-status span:nth-last-child(1) { display: none; }

  .chat-window .window-body { height: 460px; }
  .chat-page { display: none; }
  .chat-panel { width: 100%; }
  .chat-msg { font-size: 10px; }
  .chat-transcript { padding: 14px 14px 6px; }
  .chat-code pre { font-size: 8px; }
}

@media (max-width: 430px) {
  .hero-window .window-body { height: 300px; }
  .page-title { font-size: 21px; }
  .page-copy p { font-size: 9px; }
  .video-meta strong { font-size: 8px; }

  .canvas-surface { min-height: 590px; }
  .canvas-grid { min-height: 590px; padding-left: 9px; padding-right: 9px; }
  .paper-node h3 { font-size: 9.5px; }
  .paper-node footer { font-size: 6.5px; }
  .canvas-status span:first-child { max-width: 180px; }

  .chat-window .window-body { height: 440px; }
  .chat-suggestions { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mini-edges path,
  .mini-edge,
  .edge-flow,
  .mini-tabs span,
  .mini-typing i,
  .chat-typing i,
  .mini-lock-chip,
  .mini-update-ring .icon,
  .mini-progress i,
  .chat-stream::after {
    animation: none !important;
  }

  .paper-node {
    opacity: 1;
    transform: none;
  }

  .scene {
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   Research scenes: Project / Library / Canvas
   ========================================================= */

/* ---------- sidebar additions ---------- */

.papers-sidebar {
  position: relative;
  width: 158px;
  overflow: visible;
}

.sidebar-search-row {
  display: flex;
  align-items: stretch;
  gap: 5px;
  margin-bottom: 7px;
}

.sidebar-search-row .papers-search {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.sidebar-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid #2e3238;
  border-radius: 5px;
  background: #22252a;
  color: #a6aebb;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sidebar-plus .icon {
  width: 10px;
  height: 10px;
}

.sidebar-plus:hover {
  background: #2a2e34;
  border-color: #3f4650;
  color: #e6e8ec;
}

.sidebar-plus.is-pulsing {
  animation: sidebarPlusPulse 0.9s var(--ease-out);
}

@keyframes sidebarPlusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(157, 182, 207, 0); }
  35% { box-shadow: 0 0 0 4px rgba(157, 182, 207, 0.18); background: #2a323c; color: #dbe6f2; }
}

.project-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  max-width: 100%;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #22252a;
  color: #a6aebb;
  font-size: 7px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.project-chip:hover {
  color: #e6e8ec;
}

.project-chip.is-on {
  border-color: #3d4a58;
  background: #2a323c;
  color: #9db6cf;
  font-weight: 600;
}

.project-chip.is-typing {
  border-style: dashed;
  border-color: #3f4650;
  background: #1d2025;
  color: #c7d4e2;
}

.project-chip .type-caret,
.request-query .type-caret {
  display: inline-block;
  width: 1px;
  height: 8px;
  margin-left: 1px;
  background: #9db6cf;
  vertical-align: -1px;
  animation: caretBlink 1s steps(1) infinite;
}

.project-chip.is-done .type-caret,
.request-query.is-done .type-caret {
  display: none;
}

.scope-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 25px;
  padding: 2px;
  border: 1px solid #2e3238;
  border-radius: 6px;
  background: #22252a;
}

.scope-pill {
  position: absolute;
  left: 2px;
  top: 2px;
  width: calc(50% - 2px);
  height: 19px;
  border: 1px solid #3d4a58;
  border-radius: 4px;
  background: #2a323c;
  transition: transform 0.3s var(--ease-out);
}

.scope-tabs[data-scope="library"] .scope-pill {
  transform: translateX(100%);
}

.scope-tabs button {
  position: relative;
  z-index: 1;
  border-radius: 4px;
  color: #79818e;
  font-size: 7px;
  font-weight: 600;
  transition: color 0.2s ease;
}

.scope-tabs button.is-on {
  color: #e6e8ec;
}

.papers-caption-row {
  display: flex;
  align-items: center;
  height: 18px;
  padding: 0 3px;
  color: #6e7787;
  font-size: 6.3px;
  font-variant-numeric: tabular-nums;
}

.paper-list {
  display: grid;
  gap: 1px;
  max-height: 235px;
  overflow: hidden;
}

.papers-sidebar .paper-row {
  padding: 4px 5px;
  font-size: 7.1px;
}

.papers-sidebar .paper-row > span:last-child {
  font-size: 6.2px;
}

.paper-list .paper-row.is-new {
  animation: paperRowIn 0.45s var(--ease-out) both;
}

@keyframes paperRowIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- add paper menu ---------- */

.add-paper-menu {
  position: absolute;
  left: 8px;
  top: 286px;
  z-index: 40;
  width: 252px;
  padding: 6px;
  border: 1px solid #3a3f47;
  border-radius: 9px;
  background: #1b1d20;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
}

.menu-label {
  display: block;
  padding: 3px 7px 6px;
  color: #79818e;
  font-size: 6.4px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.menu-row:hover {
  background: #22262c;
}

.menu-row.is-active {
  border-color: #3a4654;
  background: #242a31;
}

.menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid #2e3238;
  border-radius: 6px;
  background: #22252a;
  color: #9db6cf;
}

.menu-icon .icon {
  width: 11px;
  height: 11px;
}

.menu-row strong {
  display: block;
  color: #e6e8ec;
  font-size: 7.6px;
  font-weight: 600;
}

.menu-row em {
  display: block;
  margin-top: 1px;
  color: #79818e;
  font-size: 6.2px;
  font-style: normal;
  white-space: nowrap;
}

.menu-rule {
  height: 1px;
  margin: 4px 5px;
  background: #2e3238;
}

.import-strip,
.library-import {
  background: #1b1d20;
  border: 1px solid #3a3f47;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.import-strip {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 12px;
  z-index: 30;
  padding: 8px 9px;
}

.import-copy strong {
  display: block;
  color: #e6e8ec;
  font-size: 7px;
  font-weight: 600;
}

.import-copy span {
  display: block;
  margin-top: 2px;
  color: #79818e;
  font-size: 6.2px;
}

.import-bar {
  height: 3px;
  margin-top: 7px;
  border-radius: 2px;
  background: #2a2e34;
  overflow: hidden;
}

.import-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #6e8caa, #9db6cf);
  transition: width 0.18s linear;
}

/* ---------- research scene views ---------- */

.rs-view {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.34s ease, visibility 0.34s;
}

.rs-view.is-active {
  opacity: 1;
  visibility: visible;
}

.rs-view-project {
  background:
    radial-gradient(ellipse at 30% 48%, rgba(110, 140, 170, 0.14), transparent 48%),
    radial-gradient(ellipse at 78% 30%, rgba(191, 169, 130, 0.07), transparent 48%);
}

.project-request {
  position: absolute;
  left: 26px;
  top: 50%;
  width: 292px;
  padding: 15px 16px 16px;
  border: 1px solid #3a4048;
  border-radius: 12px;
  background: #1e2126;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  opacity: 0;
  transform: translateY(-46%) scale(0.985);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.project-request.is-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.request-label {
  display: block;
  color: #79818e;
  font-size: 6.4px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.request-query {
  min-height: 46px;
  margin-top: 9px;
  padding: 9px 10px;
  border: 1px solid #3a3f47;
  border-radius: 7px;
  background: #161719;
  color: #e6e8ec;
  font-size: 9.2px;
  line-height: 1.5;
}

.request-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
  color: #79818e;
  font-size: 6.4px;
}

.dot-sep {
  color: #3a3f47;
}

.request-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 29px;
  margin-top: 13px;
  border: 1px solid #47607a;
  border-radius: 6px;
  background: #2a323c;
  color: #dbe6f2;
  font-size: 8px;
  font-weight: 600;
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.request-generate .icon {
  width: 10px;
  height: 10px;
  color: #9db6cf;
}

.request-generate.is-pressed {
  background: #34495e;
  transform: scale(0.985);
}

.request-progress {
  margin-top: 10px;
  color: #79818e;
  font-size: 6.3px;
}

.request-progress.is-visible {
  display: block;
}

.request-bar {
  height: 3px;
  margin-top: 5px;
  border-radius: 2px;
  background: #2a2e34;
  overflow: hidden;
}

.request-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #6e8caa, #9db6cf);
  transition: width 0.2s linear;
}

.ghost-map {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 224px;
  height: 238px;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.ghost-map.is-visible {
  opacity: 1;
}

.ghost-card {
  position: absolute;
  width: 108px;
  height: 44px;
  padding: 9px 10px;
  border: 1px dashed #3a4048;
  border-radius: 7px;
  background: #1d2025;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.ghost-map.is-visible .ghost-card {
  opacity: 1;
  transform: none;
}

.ghost-map.is-visible .ghost-card.b { transition-delay: 0.12s; }
.ghost-map.is-visible .ghost-card.c { transition-delay: 0.24s; }

.ghost-card.a { left: 0; top: 96px; }
.ghost-card.b { right: 0; top: 20px; }
.ghost-card.c { right: 0; top: 150px; }

.ghost-card i,
.ghost-card b,
.ghost-card em {
  display: block;
  height: 5px;
  border-radius: 2px;
  background: #2f343b;
}

.ghost-card i { width: 84%; }
.ghost-card b { width: 58%; margin-top: 5px; background: #292e35; }
.ghost-card em { width: 34%; margin-top: 5px; height: 4px; background: #33404d; }

.ghost-edge {
  position: absolute;
  left: 106px;
  top: 116px;
  width: 79px;
  height: 1px;
  background: #3a4048;
  transform-origin: left center;
  transform: rotate(-73deg);
  opacity: 0;
  transition: opacity 0.5s ease 0.2s;
}

.ghost-edge.second {
  width: 59px;
  transform: rotate(67deg);
  transition-delay: 0.32s;
}

.ghost-map.is-visible .ghost-edge {
  opacity: 1;
}

/* ---------- library view ---------- */

.rs-view-library {
  display: flex;
  flex-direction: column;
  padding: 16px 18px 14px;
  background:
    radial-gradient(ellipse at 70% 12%, rgba(127, 153, 180, 0.11), transparent 46%),
    #161719;
}

.library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.library-head strong {
  display: block;
  color: #e6e8ec;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

.library-head > div > span {
  display: block;
  margin-top: 3px;
  color: #79818e;
  font-size: 6.5px;
}

.library-search {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 184px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid #2e3238;
  border-radius: 5px;
  background: #22252a;
  color: #79818e;
  font-size: 6.6px;
}

.library-search .icon {
  width: 9px;
  height: 9px;
}

.library-list {
  display: grid;
  gap: 5px;
  margin-top: 13px;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 82%, transparent 100%);
}

.library-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid #2e3238;
  border-radius: 7px;
  background: #1e2126;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.library-row.is-new {
  border-color: #4b5c6d;
  background: #222a32;
  animation: paperRowIn 0.45s var(--ease-out) both;
}

.library-row strong {
  display: block;
  overflow: hidden;
  color: #e6e8ec;
  font-size: 7.8px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.library-row div > span {
  display: block;
  margin-top: 2px;
  color: #79818e;
  font-size: 6.2px;
}

.library-row em {
  flex: none;
  padding: 2px 5px;
  border: 1px solid #3a3f47;
  border-radius: 999px;
  color: #9db6cf;
  font-size: 5.6px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.library-row.is-new em {
  border-color: #4b5c6d;
  color: #c7d4e2;
}

.library-import {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  z-index: 10;
  padding: 9px 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
}

.library-import.is-visible {
  opacity: 1;
  transform: none;
}

.library-toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #3f4e3f;
  border-radius: 999px;
  background: #222a24;
  color: #b9cfbb;
  font-size: 6.5px;
  font-weight: 550;
  white-space: nowrap;
  transform: translate(-50%, 6px);
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s var(--ease-out);
}

.library-toast .icon {
  width: 9px;
  height: 9px;
}

.library-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.library-context {
  position: absolute;
  right: 20px;
  top: 132px;
  z-index: 15;
  width: 174px;
  padding: 5px;
  border: 1px solid #3a3f47;
  border-radius: 8px;
  background: #1b1d20;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.24s ease, transform 0.24s var(--ease-out);
}

.library-context.is-visible {
  opacity: 1;
  transform: none;
}

.library-context button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 27px;
  padding: 0 7px;
  border-radius: 5px;
  color: #e6e8ec;
  font-size: 6.8px;
  font-weight: 550;
  text-align: left;
}

.library-context button:hover {
  background: #24282e;
}

.library-context .icon {
  width: 9px;
  height: 9px;
  color: #9db6cf;
}

.library-context .context-check {
  margin-left: auto;
  opacity: 0;
  color: #9fc0a4;
  transition: opacity 0.2s ease;
}

.library-context.is-checked .context-check {
  opacity: 1;
}

/* ---------- canvas additions ---------- */

.paper-node.is-peek .node-peek {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.paper-node.is-peek {
  border-color: #6e8caa;
  box-shadow: 0 0 0 1px #6e8caa, 0 0 0 5px rgba(110, 140, 170, 0.12), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.canvas-frame:not([data-scene="canvas"]) .canvas-tools {
  opacity: 0.45;
  pointer-events: none;
}

.canvas-frame .canvas-tools {
  transition: opacity 0.3s ease;
}

.canvas-frame .canvas-tool,
.canvas-frame .canvas-toggle {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.canvas-frame .canvas-tool.is-pressed {
  background: #33404d;
  color: #e6e8ec;
}

/* =========================================================
   PDF demo
   ========================================================= */

.pdf-window {
  position: relative;
  z-index: 1;
  border-radius: 14px;
  border-color: rgba(50, 42, 30, 0.2);
  box-shadow: 0 42px 92px rgba(72, 58, 36, 0.24), 0 10px 26px rgba(72, 58, 36, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.pdf-body {
  display: flex;
  flex: 0 0 468px;
  height: 468px;
  background: var(--pdf-canvas, #f1f3f6);
  transition: background-color 0.55s ease;
}

/* ---------- annotations sidebar ---------- */

.annotations-sidebar {
  display: flex;
  flex-direction: column;
  width: 142px;
  flex: none;
  border-right: 1px solid var(--canvas-hairline);
  background: #fbfbf9;
  overflow: hidden;
  transition: width 0.42s var(--ease-out), opacity 0.3s ease, border-color 0.3s ease;
}

.pdf-window[data-pdf-scene="citation"] .annotations-sidebar {
  width: 0;
  border-right-color: transparent;
  opacity: 0;
}

.ann-head {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  flex: none;
  padding: 0 9px;
  border-bottom: 1px solid var(--canvas-hairline);
  color: var(--canvas-text);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ann-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 4px;
  background: #f1f3f6;
  color: var(--canvas-text-3);
  font-size: 6px;
  letter-spacing: 0;
}

.ann-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  border-radius: 4px;
  color: var(--canvas-text-3);
}

.ann-search-btn:hover {
  background: #f1f3f6;
  color: var(--canvas-text);
}

.ann-search-btn .icon {
  width: 9px;
  height: 9px;
}

.ann-search {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 23px;
  margin: 8px 8px 4px;
  padding: 0 6px;
  border: 1px solid var(--canvas-hairline);
  border-radius: 5px;
  background: #fff;
  color: var(--canvas-text-3);
  font-size: 6.2px;
}

.ann-search .icon {
  width: 8px;
  height: 8px;
}

.ann-group {
  padding: 8px 9px 4px;
  color: var(--canvas-text-3);
  font-size: 5.8px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ann-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 5px;
  width: calc(100% - 10px);
  margin: 0 5px 2px;
  padding: 6px 6px 6px 0;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
  overflow: hidden;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ann-row:hover {
  background: #f4f6f8;
}

.ann-row.is-selected {
  border-color: #d3e0ec;
  background: #eff4f9;
  box-shadow: inset 0 0 0 1px rgba(127, 153, 180, 0.22);
}

.ann-rail {
  width: 3px;
  flex: none;
  border-radius: 0 2px 2px 0;
  background: var(--rail, #d8c66a);
}

.ann-rail.blue { background: #a8c0d8; }
.ann-rail.azure { background: #2a6fdb; }

.ann-copy {
  min-width: 0;
  padding-left: 1px;
}

.ann-copy strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--canvas-text);
  font-size: 6.6px;
  font-weight: 550;
  line-height: 1.38;
}

.ann-copy em {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--canvas-text-3);
  font-size: 5.9px;
  font-style: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- reader ---------- */

.reader-main {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 36px;
  flex: none;
  padding: 0 8px;
  border-bottom: 1px solid var(--canvas-hairline);
  background: rgba(251, 252, 253, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.reader-tool {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 5px;
  color: #5b6677;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.reader-tool .icon {
  width: 11px;
  height: 11px;
}

.reader-tool:hover {
  background: #edf0f4;
  color: #253044;
}

.reader-tool.is-on {
  background: #e4ecf4;
  color: #4e6783;
  box-shadow: inset 0 0 0 1px rgba(127, 153, 180, 0.34);
}

.reader-tool.is-muted {
  color: #b7bec8;
}

.reader-divider {
  width: 1px;
  height: 14px;
  margin: 0 5px;
  flex: none;
  background: var(--canvas-hairline);
}

.reader-page-label,
.reader-zoom {
  color: #5b6677;
  font-size: 6.8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reader-page-label {
  margin-left: 2px;
}

.reader-spacer {
  flex: 1;
}

.mark-dot {
  position: absolute;
  right: 4px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f0cf4f;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mark-tool.is-marking .mark-dot {
  opacity: 1;
}

.mark-tool.is-marking {
  background: #fbf3cf;
  color: #7a6a2e;
  box-shadow: inset 0 0 0 1px rgba(194, 170, 74, 0.42);
}

.bg-dot {
  position: absolute;
  right: 4px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pdf-tint, #fcfbf8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  opacity: 0.6;
}

.reader-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 15px 12px 12px;
  background: var(--pdf-canvas);
  overflow: hidden;
  transition: background-color 0.55s ease;
}

.reader-scroll {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  overflow-y: auto;
  scrollbar-width: none;
}

.reader-scroll::-webkit-scrollbar {
  display: none;
}

.reader-page {
  position: relative;
  width: 300px;
  flex: none;
  padding: 21px 22px 15px;
  border: 1px solid rgba(120, 100, 70, 0.16);
  border-radius: 2px;
  background: var(--pdf-paper, #fcfbf8);
  color: var(--pdf-ink, #2b3038);
  box-shadow: 0 1px 2px rgba(60, 48, 30, 0.08), 0 10px 26px rgba(60, 48, 30, 0.08);
  transition: background-color 0.55s ease, color 0.55s ease;
}

.paper-head {
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(120, 100, 70, 0.14);
}

.paper-head.compact {
  padding-bottom: 7px;
}

.paper-venue {
  display: block;
  color: #8a93a2;
  font-size: 5.2px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.paper-head h3 {
  margin-top: 5px;
  color: var(--pdf-ink, #253044);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.06;
  letter-spacing: -0.025em;
}

.paper-authors {
  margin-top: 4px;
  color: #79818e;
  font-size: 5.2px;
  line-height: 1.5;
}

.reader-page h4 {
  margin: 10px 0 4px;
  color: var(--pdf-ink, #253044);
  font-size: 6.5px;
  font-weight: 700;
}

.reader-page p {
  margin-top: 5px;
  color: var(--pdf-ink-2, #3d4550);
  font-size: 6.5px;
  line-height: 1.68;
  text-align: justify;
  hyphens: auto;
}

.paper-figure {
  position: relative;
  height: 64px;
  margin: 9px 0 4px;
  border: 1px solid rgba(120, 100, 70, 0.18);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.5);
}

.fig-node {
  position: absolute;
  width: 46px;
  height: 18px;
  border: 1px solid #c9d3de;
  border-radius: 3px;
  background: #f8fafc;
}

.fig-node.a { left: 14px; top: 22px; }
.fig-node.b { left: 104px; top: 9px; }
.fig-node.c { left: 104px; top: 37px; }

.fig-edge {
  position: absolute;
  left: 60px;
  top: 31px;
  width: 44px;
  height: 1px;
  background: #b8c4d2;
  transform-origin: left center;
}

.fig-edge.e2 { transform: rotate(-16deg); }
.fig-edge.e3 { transform: rotate(15deg); top: 41px; }

.reader-page figcaption {
  color: #8a93a2;
  font-size: 5.2px;
  line-height: 1.45;
}

.paper-page-number {
  margin-top: 10px;
  color: #8a93a2;
  font-size: 5.2px;
  text-align: right;
}

/* ---------- marks, notes, citation ---------- */

.mark {
  border-radius: 2px;
  padding: 0 1px;
  transition: background-color 0.32s ease, outline-color 0.3s ease;
}

.mark-yellow.is-selecting {
  background: rgba(42, 111, 219, 0.17);
}

.mark-yellow.is-on {
  background: rgba(246, 214, 88, 0.5);
}

.mark-azure.is-on {
  background: rgba(42, 111, 219, 0.09);
  outline: 1.5px dashed #2a6fdb;
  outline-offset: 2px;
}

.mark-azure.is-flash {
  animation: citeFlash 1.1s var(--ease-out);
}

@keyframes citeFlash {
  0% { background: rgba(42, 111, 219, 0.28); }
  45% { background: rgba(42, 111, 219, 0.18); }
  100% { background: rgba(42, 111, 219, 0.09); }
}

.margin-note-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.margin-note-card {
  position: absolute;
  right: 7px;
  top: 88px;
  width: 138px;
  padding: 8px 9px 9px;
  border: 1px solid #e3ddd0;
  border-radius: 8px;
  background: #fffefb;
  box-shadow: 0 10px 26px rgba(60, 48, 30, 0.14);
  opacity: 0;
  transform: translateX(8px) scale(0.98);
  transition: opacity 0.32s var(--ease-out), transform 0.32s var(--ease-out);
}

.margin-note-card.is-visible {
  opacity: 1;
  transform: none;
}

.note-page {
  float: right;
  margin-left: 5px;
  padding: 1px 4px;
  border: 1px solid #e2e6eb;
  border-radius: 999px;
  color: #8a93a2;
  font-size: 5.2px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.note-quote {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  padding-left: 5px;
  border-left: 2px solid #f0cf4f;
  color: #6e7784;
  font-size: 5.9px;
  line-height: 1.45;
}

.note-text {
  min-height: 20px;
  margin-top: 6px;
  color: #3d4550;
  font-size: 6.6px;
  line-height: 1.48;
}

.margin-note-pill {
  position: absolute;
  right: 7px;
  top: 88px;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 124px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid #e3ddd0;
  border-radius: 6px;
  background: #fffefb;
  box-shadow: 0 8px 20px rgba(60, 48, 30, 0.12);
  text-align: left;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.28s ease, transform 0.28s var(--ease-out);
}

.margin-note-pill.is-visible {
  opacity: 1;
  transform: none;
}

.pill-rail {
  width: 3px;
  height: 14px;
  flex: none;
  border-radius: 2px;
  background: #f0cf4f;
}

.pill-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #3d4550;
  font-size: 5.8px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pill-page {
  flex: none;
  color: #8a93a2;
  font-size: 5.2px;
}

/* ---------- reading background popover ---------- */

.bg-popover {
  position: absolute;
  right: 9px;
  top: 42px;
  z-index: 20;
  width: 296px;
  padding: 8px 9px 9px;
  border: 1px solid #e2e6eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(24, 32, 46, 0.2);
  opacity: 0;
  transform: translateY(-4px) scale(0.985);
  transition: opacity 0.24s ease, transform 0.24s var(--ease-out);
}

.bg-popover.is-open {
  opacity: 1;
  transform: none;
}

.bg-title {
  display: block;
  padding: 0 2px 7px;
  color: #6e7784;
  font-size: 6.4px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bg-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.bg-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 3px 0 2px;
  border-radius: 6px;
  color: #8a93a2;
  font-size: 5.9px;
  font-weight: 550;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.bg-swatch i {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(31, 36, 44, 0.14);
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.55);
  transition: box-shadow 0.2s ease;
}

.bg-swatch:hover {
  background: #f4f6f8;
  color: #253044;
}

.bg-swatch.is-on {
  color: #253044;
  font-weight: 650;
}

.bg-swatch.is-on i {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #7f99b4;
}

/* ---------- status ---------- */

.reader-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 25px;
  flex: none;
  padding: 0 11px;
  border-top: 1px solid var(--canvas-hairline);
  background: #fbfbf9;
  color: #8a93a2;
  font-size: 6.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- reader chat ---------- */

.reader-chat {
  display: flex;
  flex-direction: column;
  width: 0;
  flex: none;
  border-left: 1px solid transparent;
  background: #fbfbfc;
  opacity: 0;
  overflow: hidden;
  transition: width 0.42s var(--ease-out), opacity 0.3s ease, border-color 0.3s ease;
}

.pdf-window[data-pdf-scene="citation"] .reader-chat {
  width: 216px;
  border-left-color: var(--canvas-hairline);
  opacity: 1;
}

.reader-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 39px;
  flex: none;
  padding: 0 10px;
  border-bottom: 1px solid var(--canvas-hairline);
}

.reader-chat-head strong {
  display: block;
  color: var(--canvas-text);
  font-size: 9px;
  font-weight: 620;
  line-height: 1.1;
}

.pdf-context {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
  color: var(--canvas-text-3);
  font-size: 5.9px;
}

.pdf-context i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #6f8b72;
}

.reader-chat-head > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid var(--canvas-hairline);
  border-radius: 5px;
  color: var(--canvas-text-2);
}

.reader-chat-head .icon {
  width: 9px;
  height: 9px;
}

.reader-chat-transcript {
  flex: 1;
  min-height: 0;
  padding: 10px 10px 4px;
  overflow: hidden;
}

.pdf-msg {
  font-size: 6.8px;
  line-height: 1.55;
}

.pdf-msg.is-user {
  width: fit-content;
  max-width: 92%;
  margin-left: auto;
  padding: 6px 8px;
  border-radius: 8px 8px 3px 8px;
  background: #dfeaf4;
  color: #34455a;
}

.pdf-msg.is-assistant {
  margin-top: 10px;
  color: #3d4550;
}

.pdf-answer-line {
  white-space: pre-wrap;
}

.pdf-answer-line::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.14em;
  background: currentColor;
  animation: caretBlink 1s steps(1) infinite;
}

.pdf-msg.is-done .pdf-answer-line::after {
  display: none;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 13px;
  padding: 0 3px;
  border: 1px solid #c9dbef;
  border-radius: 4px;
  background: #eff5fc;
  color: #2a6fdb;
  font-size: 5.8px;
  font-weight: 650;
  vertical-align: 1px;
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.citation-chip:hover {
  background: #e2eefb;
}

.citation-chip.is-pressed {
  background: #d6e8fa;
  transform: scale(0.94);
}

.citation-chip.is-active {
  border-color: #2a6fdb;
}

.quoted-chip {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  padding: 6px 7px;
  border: 1px solid #e2e6eb;
  border-left: 2px solid #2a6fdb;
  border-radius: 6px;
  background: #fbfcfe;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.28s ease, transform 0.28s var(--ease-out);
}

.quoted-chip.is-visible {
  opacity: 1;
  transform: none;
}

.quoted-chip .icon {
  width: 9px;
  height: 9px;
  flex: none;
  color: #2a6fdb;
}

.quoted-chip strong {
  display: block;
  color: #2a6fdb;
  font-size: 5.6px;
  font-weight: 650;
}

.quoted-chip span {
  display: block;
  margin-top: 2px;
  color: #5b6677;
  font-size: 5.8px;
  line-height: 1.45;
}

.pdf-composer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 28px;
  margin: 6px 10px 10px;
  padding: 0 4px 0 8px;
  border: 1px solid #d4dae1;
  border-radius: 7px;
  background: #fff;
  color: #8a93a2;
  font-size: 6.2px;
  flex: none;
}

.pdf-composer .composer-send {
  width: 20px;
  height: 20px;
}

.pdf-composer .composer-send .icon {
  width: 10px;
  height: 10px;
}

/* ---------- pdf window chrome tuning ---------- */

.pdf-window .tab-favicon.pdf {
  background: linear-gradient(135deg, #e2b0a4, #b8564a);
}

.pdf-window .tab-title {
  max-width: 190px;
}

/* =========================================================
   Demo responsive: research scenes and PDF
   ========================================================= */

@media (max-width: 1120px) {
  .preview-research .research-grid,
  .pdf-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 54px;
  }

  .section-copy {
    max-width: 720px;
  }

  .section-copy .display-sm {
    font-size: clamp(38px, 5.4vw, 56px);
  }

  .section-copy .lede {
    max-width: 48ch;
  }

  .research-stage,
  .pdf-stage {
    width: 100%;
    max-width: 860px;
  }

  .preview-research {
    padding: 118px 0 96px;
  }

  .pdf-section {
    padding: 96px 0 90px;
  }
}

@media (max-width: 760px) {
  .preview-research {
    padding: 92px 0 78px;
  }

  .pdf-section {
    padding: 78px 0 72px;
  }

  .section-copy .display-sm {
    font-size: clamp(34px, 8.4vw, 46px);
  }

  .section-copy .lede {
    margin-top: 16px;
    font-size: 16px;
  }

  .copy-tags {
    margin-top: 20px;
  }

  .demo-scenes {
    flex-wrap: wrap;
    gap: 8px;
  }

  .demo-scene-tabs {
    order: 1;
    width: 100%;
    justify-content: space-between;
  }

  .demo-scene-tab {
    flex: 1;
    justify-content: center;
    padding: 0 6px;
    font-size: 10.5px;
  }

  .demo-controls {
    order: 0;
    margin-left: auto;
  }

  .canvas-frame {
    border-radius: 12px;
  }

  .canvas-toolbar {
    height: auto;
    min-height: 46px;
    padding: 7px 10px;
    flex-wrap: wrap;
  }

  .canvas-title span {
    display: none;
  }

  .canvas-tools {
    width: 100%;
    justify-content: space-between;
  }

  .canvas-tool span:last-child,
  .canvas-toggle span:last-child {
    font-size: 7px;
  }

  .canvas-body {
    height: auto;
    flex-direction: column;
  }

  .papers-sidebar {
    display: none;
  }

  .canvas-surface {
    min-height: 460px;
  }

  .canvas-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 8px;
    height: auto;
    min-height: 460px;
    padding: 50px 10px 16px;
    align-content: start;
  }

  .paper-node {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 58px;
  }

  .node-peek {
    display: none;
  }

  .canvas-minimap {
    display: none;
  }

  .project-request {
    left: 14px;
    right: 14px;
    top: 50%;
    width: auto;
  }

  .ghost-map {
    display: none;
  }

  .rs-view-library {
    padding: 12px;
  }

  .library-search {
    width: 132px;
  }

  .library-list {
    margin-top: 10px;
  }

  .library-row:nth-child(n + 5) {
    display: none;
  }

  .library-context {
    right: 12px;
    top: 118px;
  }

  .library-import {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .canvas-status {
    font-size: 6.2px;
    gap: 4px;
  }

  .canvas-status span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .canvas-status .status-sep:nth-of-type(2),
  .canvas-status span:last-child {
    display: none;
  }

  /* PDF */

  .pdf-paper-stack {
    display: none;
  }

  .pdf-body {
    height: 420px;
  }

  .annotations-sidebar {
    display: none;
  }

  .reader-page {
    width: 280px;
  }

  .reader-viewport {
    padding: 12px 8px 8px;
  }

  .margin-note-card {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 26px;
    width: auto;
  }

  .margin-note-pill {
    right: 8px;
    top: auto;
    bottom: 26px;
    width: 120px;
  }

  .bg-popover {
    right: 6px;
    width: 280px;
  }

  .bg-swatch i {
    width: 21px;
    height: 21px;
  }

  .pdf-window[data-pdf-scene="citation"] .reader-chat {
    position: absolute;
    right: 0;
    bottom: 0;
    top: 36px;
    z-index: 18;
    width: 200px;
    box-shadow: -18px 0 38px rgba(24, 32, 46, 0.12);
  }

  .reader-toolbar .reader-zoom {
    display: none;
  }
}

@media (max-width: 430px) {
  .section-copy .display-sm {
    font-size: clamp(30px, 8.8vw, 38px);
  }

  .demo-scene-tab {
    font-size: 10px;
    gap: 0;
  }

  .scene-index {
    display: none;
  }

  .canvas-surface {
    min-height: 430px;
  }

  .canvas-grid {
    min-height: 430px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .paper-node h3 {
    font-size: 9.5px;
  }

  .canvas-status span:first-child {
    max-width: 180px;
  }

  .pdf-body {
    height: 396px;
  }

  .reader-page {
    width: 248px;
    padding: 18px 18px 12px;
  }

  .reader-page p {
    font-size: 6.2px;
  }

  .margin-note-card {
    width: auto;
    padding: 8px 9px;
  }

  .note-page {
    font-size: 7px;
  }

  .note-quote {
    font-size: 8px;
  }

  .note-text {
    font-size: 8.5px;
  }

  .bg-popover {
    width: 262px;
  }

  .pdf-window[data-pdf-scene="citation"] .reader-chat {
    width: 184px;
  }
}

@media (max-width: 560px) {
  .pdf-window[data-pdf-scene="citation"] .reader-chat {
    position: absolute;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 26px;
    width: auto;
    height: 190px;
    border: 1px solid var(--canvas-hairline);
    border-radius: 12px;
    box-shadow: 0 -16px 36px rgba(24, 32, 46, 0.16);
    overflow: hidden;
  }

  .pdf-window[data-pdf-scene="citation"] .reader-chat .reader-chat-transcript {
    overflow-y: auto;
  }

  .pdf-window[data-pdf-scene="citation"] #reader-scroll {
    padding-bottom: 120px;
  }
}

@media (max-width: 760px) {
  .paper-node {
    min-height: 44px;
    padding: 6px 8px 5px 11px;
  }

  .paper-node h3 {
    font-size: 9px;
    -webkit-line-clamp: 1;
  }

  .paper-node footer {
    margin-top: 3px;
    padding-top: 3px;
    font-size: 6px;
  }

  .node-stripe {
    top: 7px;
    bottom: 7px;
  }

  .canvas-grid {
    gap: 5px;
    min-height: 460px;
    padding: 48px 10px 14px;
  }
}
