/* 演示窗口右栏：和客户端一致的图标页签（选中底块滑动）、页签内容、提问框 */
.rp-tabs {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  align-self: flex-start;
  flex: none;
}
.rp-tab {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}
.rp-tab .ico {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp-tab.on {
  color: var(--text-primary);
  background: var(--bg-active);
}
.rp-tabs.has-pill .rp-tab.on {
  background: transparent;
}
.rp-tab:hover:not(.on) {
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.rp-tab:active {
  transform: scale(0.94);
}
.rp-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.rp-pill {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-active);
  opacity: 0;
  pointer-events: none;
  /* 近似客户端的弹簧：略过冲再回落 */
  transition:
    transform 420ms cubic-bezier(0.34, 1.36, 0.5, 1),
    width 420ms cubic-bezier(0.34, 1.36, 0.5, 1);
}
.rp-tabs.has-pill .rp-pill {
  opacity: 1;
}
/* 悬停提示 */
.rp-tab::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 5;
  transform: translate(-50%, -2px);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-on);
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
@media (hover: hover) {
  .rp-tab:hover::after {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 350ms;
  }
}
.rp-tab:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
/* 有新内容的小点 */
.rp-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--highlight);
  box-shadow: 0 0 0 2px var(--bg-panel);
  animation: rp-pop var(--dur-slow) var(--ease-out) both;
}
@keyframes rp-pop {
  from {
    transform: scale(0);
  }
}
/* 进入视野后给下一个页签一次轻微提示 */
.rp-tabs.cue .rp-tab:not(.on):nth-child(2)::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--line-strong);
  animation: rp-cue 1.6s var(--ease-out) 2;
}
@keyframes rp-cue {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

/* 内容区：页签的视图叠在同一处，切换时交叉淡入并横向滑一小段 */
.rp-views {
  position: relative;
  flex: 1;
  min-height: 0;
}
.rp-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  visibility: hidden;
  opacity: 0;
}
.rp-view::-webkit-scrollbar {
  display: none;
}
.rp-view.on {
  visibility: visible;
  opacity: 1;
}
/* 内容超出时上下渐隐，不露出硬切边；顶部只在滚过之后才渐隐 */
.rp-view.scrolled {
  -webkit-mask-image: linear-gradient(transparent, #000 14px);
  mask-image: linear-gradient(transparent, #000 14px);
}
.rp-views::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  background: linear-gradient(transparent, var(--bg-panel));
  pointer-events: none;
}

/* 阶段重点卡片的类别行 */
.card .kind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* 本课资料与术语 */
.rp-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rp-head b {
  font-size: 14px;
  color: var(--text-primary);
}
.rp-head span {
  font-size: 11.5px;
  color: var(--text-muted);
}
.rp-files {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rp-file {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  column-gap: 9px;
  align-items: center;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-primary);
  transition: background var(--dur-fast) var(--ease-out);
}
.rp-file:hover {
  background: var(--bg-hover);
}
.rp-file .ico {
  grid-row: 1 / 3;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp-file span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rp-file em {
  font-style: normal;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
  white-space: nowrap;
}
.rp-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
}
.rp-drop .ico {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp-sec {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.rp-sec em {
  font-style: normal;
  font-size: 10.5px;
  padding: 0 6px;
  line-height: 17px;
  border-radius: var(--radius-pill);
  background: var(--bg-active);
}
.rp-terms {
  display: flex;
  flex-direction: column;
}
.rp-terms > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line-subtle);
  font-size: 12.5px;
}
.rp-terms > div:first-child {
  border-top: 0;
}
.rp-terms span {
  color: var(--text-secondary);
}
.rp-terms b {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.rp-terms.rich > div {
  flex-wrap: wrap;
  row-gap: 0;
}
.rp-terms.rich small {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--text-muted);
}

/* 问答 */
.rp-msgs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rp-comp {
  flex: none;
  padding: 10px 12px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  transition: border-color var(--dur-base) var(--ease-out);
}
.rp-comp.typing {
  border-color: var(--text-muted);
}
.rp-views + .rp-comp,
.rp-view .rp-comp {
  margin-top: auto;
}
.rp-input {
  min-height: 20px;
  font-size: 12.5px;
  line-height: 20px;
  color: var(--text-primary);
}
.rp-input::before {
  content: attr(data-ph);
  color: var(--text-muted);
}
.rp-comp.typing .rp-input::before {
  content: none;
}
.rp-caret {
  display: none;
  width: 1.5px;
  height: 14px;
  margin-left: 1px;
  vertical-align: -2px;
  background: var(--text-primary);
  animation: rp-blink var(--dur-loop-caret) steps(1) infinite;
}
.rp-comp.typing .rp-caret {
  display: inline-block;
}
@keyframes rp-blink {
  50% {
    opacity: 0;
  }
}
.rp-comp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  color: var(--text-muted);
}
.rp-comp-row .ico {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rp-send {
  margin-left: auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  opacity: 0.3;
  transition: opacity var(--dur-base) var(--ease-out);
}
.rp-comp.typing .rp-send {
  opacity: 1;
}
.rp-send .ico {
  width: 13px;
  height: 13px;
}
.rp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  transition: opacity var(--dur-base) var(--ease-out);
}
.rp-chips.used {
  opacity: 0.45;
}
.rp-chip {
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-instant) var(--ease-out);
}
.rp-chip:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.rp-chip:active:not(:disabled) {
  transform: scale(0.97);
}
.rp-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.rp-chip:disabled {
  cursor: default;
}
.rp-think {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.rp-think i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: rp-think 1.1s ease-in-out infinite;
}
.rp-think i:nth-child(2) {
  animation-delay: 0.15s;
}
.rp-think i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes rp-think {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}
.rp-w {
  animation: rp-word 360ms var(--ease-out) both;
}
@keyframes rp-word {
  from {
    opacity: 0;
    filter: blur(3px);
  }
}
.card .cite.h {
  opacity: 0;
}
.card .cite {
  transition: opacity var(--dur-slow) var(--ease-out);
}
.qa-card .cite .ico {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  .rp-pill,
  .rp-tab,
  .rp-chip,
  .rp-w {
    transition-duration: 1ms;
    animation-duration: 1ms;
  }
}

/* 右栏贴着窗口的高度，不被左侧长内容撑高 */
.win-body {
  grid-template-rows: minmax(0, 1fr);
}
.win-main {
  min-height: 0;
}
.qa-a > div + div {
  margin-top: 4px;
}

/* 评审后的补充 */
.rp-tab.on::after {
  display: none;
}
.rp-views {
  --rp-fade: var(--bg-panel);
}
.rp-view[data-v='uchat'] .rp-msgs {
  flex: 1;
}
.rp-view .rp-comp {
  margin-top: 0;
}
.rp-chips {
  margin-top: 0;
}
.rp-chips[hidden] {
  display: none;
}
.rp-empty {
  padding: 28px 8px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.rp-terms.rich > div {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.src .mono {
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .rp-dot,
  .rp-think i {
    animation: none;
  }
}
/* 窄屏：右栏不再隐藏，排到正文下面，固定高度 */
@media (max-width: 760px) {
  .win-right:has(> .rp-tabs) {
    display: flex;
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line-subtle);
    height: 330px;
    padding: 14px 16px;
  }
  .win-body:has(> .win-right > .rp-tabs) {
    grid-template-rows: auto auto;
  }
  .win-body:has(> .win-right > .rp-tabs) .win-pane {
    min-height: 0;
  }
  .live .win-pane {
    min-height: 360px;
  }
  .rp-views {
    flex: 1;
  }
}
