/* ============================================================
   练习 (AI 聊天) 样式
   ============================================================ */

.practice-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 模式选择器 */
.practice-mode-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: var(--tg-secondary-bg);
  border-bottom: 1px solid var(--tg-bg);
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.practice-mode-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 16px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  background: var(--tg-bg);
  color: var(--tg-hint);
  white-space: nowrap;
  transition: all 0.15s;
}
.practice-mode-btn--active {
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-weight: 500;
}

/* 场景选择下拉 */
.practice-scenario-select {
  display: none;
  padding: 8px 12px;
  background: var(--tg-secondary-bg);
}
.practice-scenario-select select {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--tg-hint);
  background: var(--tg-bg);
  color: var(--tg-text);
  font-size: 14px;
}

/* 聊天消息区 */
.practice-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

/* 消息气泡 */
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg--user {
  align-self: flex-end;
  background: var(--tg-button);
  color: var(--tg-button-text);
  border-bottom-right-radius: 4px;
}
.msg--ai {
  align-self: flex-start;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  border-bottom-left-radius: 4px;
}
.msg__time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

/* 打字指示器 */
.msg--typing {
  align-self: flex-start;
  background: var(--tg-secondary-bg);
  padding: 12px 16px;
}
.typing-dots {
  display: flex;
  gap: 4px;
}
.typing-dots span {
  width: 8px; height: 8px;
  background: var(--tg-hint);
  border-radius: 50%;
  animation: dotBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); }
  40% { transform: scale(1); }
}

/* 输入栏 */
.practice-input-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--tg-bg);
  border-top: 1px solid var(--tg-secondary-bg);
  flex-shrink: 0;
  padding-bottom: calc(8px + var(--safe-bottom));
}
.practice-input-bar input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--tg-secondary-bg);
  border-radius: 20px;
  font-size: 15px;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  outline: none;
}
.practice-input-bar input:focus {
  border-color: var(--tg-button);
}
.practice-input-bar button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.practice-input-bar button:disabled {
  opacity: 0.5;
}

/* 欢迎提示 */
.practice-welcome {
  text-align: center;
  padding: 20px;
  color: var(--tg-hint);
  font-size: 14px;
  line-height: 1.6;
}
