/*
代码介绍：
  这是儿童 AI 陪伴产品最小测试页的样式文件，负责聊天页面布局、状态、消息气泡和输入区。
使用说明：
  由 static/index.html 自动引用；无需单独运行。
参数说明：
  本文件无命令行 arg；颜色和尺寸通过 CSS 变量在 :root 中配置。
*/
:root {
  color-scheme: light;
  --paper: #fffdf7;
  --surface: #ffffff;
  --ink: #1f2937;
  --muted: #607083;
  --line: #d7e2dc;
  --blue: #2f6fbb;
  --blue-dark: #214f91;
  --green: #3f8f6b;
  --coral: #d96b5f;
  --yellow: #f5c451;
  --bubble-user: #e8f2ff;
  --bubble-ai: #f7f1df;
  --shadow: 0 18px 45px rgba(43, 62, 80, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 111, 187, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(245, 196, 81, 0.2), transparent 42%),
    var(--paper);
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.chat-panel {
  width: min(960px, 100%);
  height: min(760px, calc(100vh - 56px));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.top-bar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(63, 143, 107, 0.12), rgba(47, 111, 187, 0.1));
}

.identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: #f7f7f7;
}

h1 {
  margin: 0 0 5px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 760;
}

p {
  margin: 0;
}

#modelLine {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.status-pill {
  min-width: 86px;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.status-pill.warn {
  background: var(--coral);
}

.status-pill.ready {
  background: var(--green);
}

.messages {
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.48)),
    repeating-linear-gradient(
      0deg,
      rgba(47, 111, 187, 0.035),
      rgba(47, 111, 187, 0.035) 1px,
      transparent 1px,
      transparent 32px
    );
}

.message {
  max-width: min(680px, 86%);
  display: grid;
  gap: 6px;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message.user .role {
  text-align: right;
}

.bubble {
  border: 1px solid rgba(96, 112, 131, 0.18);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 18px rgba(31, 41, 55, 0.07);
}

.message.user .bubble {
  background: var(--bubble-user);
}

.message.assistant .bubble {
  background: var(--bubble-ai);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

textarea {
  width: 100%;
  min-height: 54px;
  max-height: 160px;
  resize: vertical;
  border: 1px solid #c9d6dd;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  line-height: 1.45;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 187, 0.14);
}

.composer-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

button {
  min-width: 72px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 760;
  white-space: nowrap;
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.primary-button {
  color: #ffffff;
  background: var(--blue);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-dark);
}

.ghost-button {
  color: var(--blue-dark);
  background: #eef5f1;
}

.ghost-button:hover:not(:disabled) {
  background: #e1efe8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0;
  }

  .chat-panel {
    width: 100%;
    min-height: 100vh;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .top-bar {
    align-items: flex-start;
    padding: 14px;
  }

  .avatar {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  h1 {
    font-size: 17px;
  }

  #modelLine {
    font-size: 12px;
  }

  .status-pill {
    min-width: 70px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .messages {
    padding: 14px;
  }

  .message {
    max-width: 94%;
  }

  .composer {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .composer-actions {
    justify-content: flex-end;
  }
}
