/* 词库页 · 百词斩式网格 */
.ew-lib-page { padding-bottom: 8px; }

.ew-lib-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
}

.ew-lib-top__title { font-size: 22px; font-weight: 700; }

.ew-lib-cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px 4px;
  padding: 0 12px 16px;
}

.ew-lib-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: var(--ew-radius-sm);
  transition: background 0.15s;
}

.ew-lib-cat:active { background: var(--ew-bg-muted); }

.ew-lib-cat__icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ew-font-word);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ew-lib-cat__label {
  font-size: 11px;
  color: var(--ew-text-secondary);
  text-align: center;
  line-height: 1.25;
}

.ew-lib-list { padding: 0 16px; }

.ew-lib-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--ew-bg-elevated);
  border-radius: var(--ew-radius-md);
  border: 1px solid var(--ew-border);
  text-align: left;
  box-shadow: var(--ew-shadow-sm);
}

.ew-lib-item:active { transform: scale(0.99); }

.ew-lib-item__cover {
  width: 52px;
  height: 68px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--ew-font-word);
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.ew-lib-item__body { flex: 1; min-width: 0; }
.ew-lib-item__name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.ew-lib-item__desc { font-size: 12px; color: var(--ew-text-tertiary); line-height: 1.4; margin-bottom: 8px; }
.ew-lib-item__meta { font-size: 11px; color: var(--ew-text-secondary); }

.ew-lib-item__bar {
  height: 4px;
  background: var(--ew-bg-muted);
  border-radius: var(--ew-radius-full);
  overflow: hidden;
  margin-top: 6px;
}

.ew-lib-item__bar-fill { height: 100%; border-radius: var(--ew-radius-full); }

/* 情景分析 · AI 对话 */
.ew-scenario-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0;
}

.ew-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ew-chat-bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  animation: ew-fade-in 0.25s ease;
}

.ew-chat-bubble--ai {
  align-self: flex-start;
  background: var(--ew-bg-elevated);
  border: 1px solid var(--ew-border);
  border-bottom-left-radius: 4px;
}

.ew-chat-bubble--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--ew-primary) 0%, var(--ew-primary-deep) 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ew-chat-bubble__name {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.7;
}

.ew-chat-word-card {
  margin-top: 10px;
  padding: 12px;
  background: var(--ew-primary-soft);
  border-radius: var(--ew-radius-md);
  border: 1px solid rgba(91, 159, 212, 0.2);
}

.ew-chat-word-card__lemma {
  font-family: var(--ew-font-word);
  font-size: 28px;
  font-weight: 700;
  color: var(--ew-primary-deep);
  margin-bottom: 4px;
}

.ew-chat-word-card__def { font-size: 13px; color: var(--ew-text-secondary); margin-bottom: 10px; }

.ew-chat-templates {
  padding: 8px 16px 4px;
  border-top: 1px solid var(--ew-border);
  background: var(--ew-bg-elevated);
}

.ew-chat-templates__label {
  font-size: 11px;
  color: var(--ew-text-tertiary);
  margin-bottom: 8px;
}

.ew-chat-templates__scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.ew-chat-templates__scroll::-webkit-scrollbar { display: none; }

.ew-chat-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--ew-radius-full);
  border: 1px solid var(--ew-border);
  background: var(--ew-bg);
  font-size: 13px;
  color: var(--ew-text-secondary);
  white-space: nowrap;
}

.ew-chat-chip:active { background: var(--ew-primary-soft); border-color: var(--ew-primary); }

.ew-chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px calc(10px + var(--ew-safe-bottom));
  background: var(--ew-bg-elevated);
  border-top: 1px solid var(--ew-border);
}

.ew-chat-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ew-border);
  border-radius: var(--ew-radius-full);
  font-size: 14px;
  background: var(--ew-bg);
  outline: none;
}

.ew-chat-input:focus { border-color: var(--ew-primary); }

.ew-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ew-primary), var(--ew-primary-deep));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ew-emotion-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px 16px;
}

.ew-emotion-stat {
  padding: 14px 10px;
  background: var(--ew-bg-elevated);
  border-radius: var(--ew-radius-md);
  text-align: center;
  box-shadow: var(--ew-shadow-sm);
}

.ew-emotion-stat__val {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--ew-font-word);
  color: var(--ew-primary-deep);
}

.ew-emotion-stat__lbl { font-size: 11px; color: var(--ew-text-tertiary); margin-top: 4px; }

.ew-chat-word-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.ew-chat-word-opt {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--ew-radius-md);
  border: 2px solid var(--ew-border);
  background: var(--ew-bg);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.ew-chat-word-opt:active {
  border-color: var(--ew-primary);
  background: var(--ew-primary-soft);
}

.ew-chat-word-opt__lemma {
  display: block;
  font-family: var(--ew-font-word);
  font-size: 20px;
  font-weight: 700;
  color: var(--ew-primary-deep);
  margin-bottom: 4px;
}

.ew-chat-word-opt__def {
  font-size: 12px;
  color: var(--ew-text-secondary);
  line-height: 1.4;
}

.ew-story-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.ew-story-step {
  flex: 1;
  text-align: center;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ew-text-tertiary);
  border-bottom: 2px solid var(--ew-border);
  transition: all 0.2s;
}

.ew-story-step--active {
  color: var(--ew-primary-deep);
  border-color: var(--ew-primary);
}

.ew-story-step--done {
  color: var(--ew-peace-deep);
  border-color: var(--ew-peace);
}

.ew-chat-chip--muted {
  color: var(--ew-text-tertiary);
  border-style: dashed;
}

.ew-profile-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 32px;
  color: var(--ew-text-tertiary);
  text-align: center;
}

.ew-profile-placeholder__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ew-bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  opacity: 0.5;
}
