/* 我问智能体：教室大屏上看，最新一问一答最显眼，旧的淡下去 */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 1.4rem;
  background: rgba(255, 253, 247, 0.92);
  border-bottom: 2px solid var(--line);
  flex: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: inherit;
  text-decoration: none;
}
.brand img {
  width: 2.1rem;
  height: 2.1rem;
}
.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.topic {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--orange-deep);
  background: var(--orange-soft);
  padding: 0.3em 0.9em;
  border-radius: 999px;
}
.topic i {
  width: 0.3em;
  height: 0.3em;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.spacer {
  flex: 1;
}

/* —— 对话区 */
.talk {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0 1.2rem;
  scroll-behavior: smooth;
}
.talk > * {
  width: min(92vw, 58rem);
  margin-left: auto;
  margin-right: auto;
}

.msg {
  display: flex;
  gap: 0.7rem;
  margin-top: 0.9rem;
  transition: opacity 0.4s;
  animation: rise 0.35s ease-out both;
}
.msg.old {
  opacity: 0.55;
}
.msg.ai .avatar {
  width: 2.3rem;
  height: 2.3rem;
  flex: none;
  margin-top: 0.15rem;
}
.msg .bubble {
  border-radius: 1.1rem;
  padding: 0.7rem 1.1rem;
  line-height: 1.65;
  box-shadow: var(--shadow);
}
.msg.ai .bubble {
  background: var(--card);
  border: 2px solid var(--line);
  border-top-left-radius: 0.35rem;
  font-size: 1.12rem;
  max-width: calc(100% - 3rem);
}
.msg.ai .bubble p {
  margin: 0;
  animation: rise 0.4s ease-out both;
}
.msg.ai .bubble p + p {
  margin-top: 0.25em;
}
.msg.ai .note {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.55rem;
  color: var(--muted);
}

.msg.me {
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}
.msg.me .who {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--muted);
  margin-right: 0.4rem;
}
.msg.me .bubble {
  background: var(--blue-soft);
  border-top-right-radius: 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  max-width: 80%;
  box-shadow: none;
}

.bubble.thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  color: var(--ink-soft);
  font-size: 0.85rem !important;
}
.dots {
  display: inline-flex;
  gap: 0.25em;
}
.dots i {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--orange);
  animation: hop 1s infinite ease-in-out;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.bubble.error {
  color: var(--red);
  font-size: 0.9rem !important;
}
.bubble.error .btn {
  margin-top: 0.4rem;
  font-size: 0.7rem;
}

/* —— 底部：可以接着问的问题 + 输入 */
.dock {
  flex: none;
  padding: 0.6rem 0 0.8rem;
  background: linear-gradient(rgba(255, 253, 247, 0), var(--paper) 1.2rem);
}
.dock > * {
  width: min(92vw, 58rem);
  margin: 0 auto;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  min-height: 1.9rem;
}
.chip {
  border: 2px solid #f6c98a;
  background: #fffaf1;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.3em 0.95em;
  font-size: 0.75rem;
  font-weight: 600;
  animation: rise 0.3s ease-out both;
}
.chip::before {
  content: '问';
  display: inline-block;
  margin-right: 0.45em;
  font-size: 0.8em;
  color: #fff;
  background: var(--orange);
  border-radius: 0.35em;
  padding: 0 0.3em;
}
.chip:hover {
  background: var(--orange-soft);
}
.chip:disabled {
  opacity: 0.5;
}

.ask {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem;
  box-shadow: var(--shadow);
}
.ask:focus-within {
  border-color: #f6c98a;
}
.ask input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 0.35em 0.3em;
}
.ask input::placeholder {
  color: #a7b3c2;
}
.send {
  font-size: 0.85rem;
  padding: 0.5em 1.2em;
}

.mic {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.55em 1em;
  transition: background 0.2s;
}
.mic svg {
  width: 1.1em;
  height: 1.1em;
}
.mic .level {
  display: none;
  align-items: center;
  gap: 0.12em;
  height: 1em;
}
.mic .level i {
  width: 0.16em;
  height: 20%;
  background: #fff;
  border-radius: 1em;
  transition: height 0.08s;
}
.mic.recording {
  background: var(--red);
}
.mic.recording .level {
  display: inline-flex;
}
.mic.busy {
  background: var(--ink-soft);
}

/* 手机扫码打开（评委、家长）：顶栏只留名字和两个按钮 */
@media (max-width: 560px) {
  :root {
    font-size: 16px;
  }
  .masthead {
    gap: 0.4rem;
    padding: 0.5rem 0.8rem;
  }
  .topic {
    display: none;
  }
  .brand-name,
  .icon-btn {
    white-space: nowrap;
  }
  .mic-label {
    display: none;
  }
  .mic.recording .mic-label {
    display: inline;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}
@keyframes hop {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-0.35em);
    opacity: 1;
  }
}
