/* 情绪大师 - 视觉与动画 */

:root {
  --mood-bg: #faf8f5;
  --mood-bg-card: #fdfbf7;
  --mood-primary: #6f4e37;
  --mood-accent: #c4a77d;
  --mood-highlight: #d4a574;
  --mood-border: #e8ddd2;
  --mood-text: #3e2723;
  --mood-muted: #8d7b6a;
}

.mood-body {
  background: var(--mood-bg);
  color: var(--mood-text);
}

/* 顶部 */
.mood-header {
  background: var(--mood-bg-card);
  border-bottom: 1px solid var(--mood-border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mood-select,
.mood-input {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--mood-border);
  background: #fff;
  color: var(--mood-text);
  font-size: 0.875rem;
}

.mood-input::placeholder {
  color: var(--mood-muted);
}

/* 统一输入卡片 */
.mood-input-card {
  background: var(--mood-bg-card);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 16px rgba(111, 78, 55, 0.06);
  border: 1px solid var(--mood-border);
  margin-bottom: 1.5rem;
}

.mood-input-lead {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--mood-muted);
  margin-bottom: 1.25rem;
  padding: 0;
}

.mood-input-block {
  margin-bottom: 1.25rem;
}

.mood-input-block:last-of-type {
  margin-bottom: 0;
}

.mood-input-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--mood-text);
  margin-bottom: 0.5rem;
}

.mood-textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--mood-border);
  background: #fff;
  color: var(--mood-text);
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mood-textarea::placeholder {
  color: var(--mood-muted);
}

.mood-textarea:focus {
  outline: none;
  border-color: var(--mood-accent);
  box-shadow: 0 0 0 3px rgba(196, 167, 125, 0.2);
}

.mood-input-meta {
  font-size: 0.75rem;
  color: var(--mood-muted);
  margin-top: 0.35rem;
}

/* 情绪芯片 */
.mood-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mood-chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--mood-border);
  background: #fff;
  color: var(--mood-text);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mood-chip:hover {
  border-color: var(--mood-accent);
  color: var(--mood-primary);
}

.mood-chip-active {
  background: var(--mood-accent);
  border-color: var(--mood-accent);
  color: #fff;
}

/* 图片上传 */
.mood-upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mood-upload-btn {
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: 1px dashed var(--mood-border);
  background: #fff;
  color: var(--mood-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.mood-upload-btn:hover {
  border-color: var(--mood-accent);
  color: var(--mood-primary);
}

.mood-upload-preview {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--mood-border);
  flex-shrink: 0;
}

.mood-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mood-upload-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.mood-upload-remove:hover {
  background: rgba(0,0,0,0.7);
}

.mood-submit-row {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--mood-border);
}

.mood-btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  width: 100%;
  max-width: 280px;
  display: block;
  margin: 0 auto;
}

.mood-submit-hint {
  font-size: 0.8125rem;
  color: var(--mood-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* 情绪标签（保留给其他处用） */
.mood-tag {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--mood-border);
  background: #fff;
  color: var(--mood-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mood-tag:hover {
  border-color: var(--mood-accent);
  color: var(--mood-primary);
}

.mood-tag-active {
  background: var(--mood-accent);
  border-color: var(--mood-accent);
  color: #fff;
}

/* 按钮 */
.mood-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 12px;
  background: var(--mood-primary);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.mood-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.mood-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 错误 */
.mood-error {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.875rem;
}

/* 动画区 */
.mood-animation-wrap {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fdfbf7 0%, #f5efe6 100%);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(111, 78, 55, 0.08);
}

.coffee-animation-stage {
  width: 100%;
  height: 360px;
  position: relative;
  display: none;
}

.coffee-animation-stage.is-active {
  display: block;
}

.anim-step {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: animFadeIn 0.5s ease-out;
}

.coffee-animation-stage.step-1.is-active .anim-step-1,
.coffee-animation-stage.step-2.is-active .anim-step-2,
.coffee-animation-stage.step-3.is-active .anim-step-3,
.coffee-animation-stage.step-4.is-active .anim-step-4 {
  display: flex;
  opacity: 1;
}

@keyframes animFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim-caption {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--mood-muted);
}

/* ─── 步骤 1：磨豆 ─── */
.anim-grinder-wrap {
  position: relative;
  width: 80px;
  height: 100px;
}

.anim-grinder-hopper {
  width: 56px;
  height: 28px;
  margin: 0 auto 0;
  background: linear-gradient(180deg, #e8ddd2 0%, #d4c4b0 100%);
  border: 2px solid var(--mood-border);
  border-radius: 8px 8px 4px 4px;
  position: relative;
  overflow: hidden;
}

.anim-bean {
  position: absolute;
  width: 10px;
  height: 6px;
  background: linear-gradient(135deg, #5d4e37 0%, #3e2723 100%);
  border-radius: 50%;
  animation: beanShake 0.6s ease-in-out infinite;
}

.anim-bean-1 { left: 8px;  top: 6px;  animation-delay: 0s; }
.anim-bean-2 { left: 24px; top: 8px;  animation-delay: 0.2s; }
.anim-bean-3 { left: 40px; top: 5px;  animation-delay: 0.4s; }

@keyframes beanShake {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(1px) rotate(2deg); }
}

.anim-grinder-body {
  width: 52px;
  height: 36px;
  margin: -2px auto 0;
  background: linear-gradient(180deg, #8d7b6a 0%, #6f4e37 100%);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(62, 39, 35, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.anim-grinder-burr {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #a08f7a, #4a3728);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.15), 0 2px 6px rgba(0,0,0,0.3);
  animation: animRotate 1.8s linear infinite;
}

@keyframes animRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.anim-grounds-fall {
  position: absolute;
  width: 4px;
  height: 6px;
  background: #3e2723;
  border-radius: 1px;
  opacity: 0;
  left: 50%;
  top: 58px;
  animation: groundsFall 1.2s ease-in infinite;
}

.anim-grounds-fall-1 { animation-delay: 0.2s; margin-left: -12px; }
.anim-grounds-fall-2 { animation-delay: 0.5s; margin-left: -2px; }
.anim-grounds-fall-3 { animation-delay: 0.8s; margin-left: 8px; }

@keyframes groundsFall {
  0% { opacity: 0; transform: translateY(0); }
  20% { opacity: 0.9; transform: translateY(0); }
  100% { opacity: 0.9; transform: translateY(32px); }
}

.anim-grounds-pile {
  position: absolute;
  left: 50%;
  bottom: 0;
  margin-left: -20px;
  width: 40px;
  height: 12px;
  background: linear-gradient(180deg, #5d4e37 0%, #3e2723 100%);
  border-radius: 50% 50% 4px 4px;
  animation: pileGrow 2.5s ease-out forwards;
}

@keyframes pileGrow {
  from { transform: scaleY(0.2); opacity: 0.6; }
  to { transform: scaleY(1); opacity: 1; }
}

/* ─── 步骤 2：萃取 ─── */
.anim-extraction-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.anim-portafilter {
  width: 24px;
  height: 20px;
  background: linear-gradient(180deg, #8d7b6a 0%, #6f4e37 100%);
  border-radius: 0 0 6px 6px;
  position: relative;
  box-shadow: 0 2px 8px rgba(62, 39, 35, 0.4);
}

.anim-portafilter::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -8px;
  width: 16px;
  height: 6px;
  background: #5d4e37;
  border-radius: 2px;
}

.anim-drip {
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 6px;
  height: 8px;
  background: linear-gradient(180deg, #6f4e37, #4a3728);
  border-radius: 50% 50% 50% 50%;
  opacity: 0;
  animation: dripFall 2.2s ease-in infinite;
}

.anim-drip-1 { margin-left: -10px; animation-delay: 0.3s; }
.anim-drip-2 { margin-left: -3px;  animation-delay: 0.9s; }
.anim-drip-3 { margin-left: 4px;  animation-delay: 1.5s; }

@keyframes dripFall {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  85% { opacity: 1; transform: translateY(48px) scale(1); }
  100% { opacity: 0; transform: translateY(56px) scale(0.8); }
}

.anim-cup {
  width: 72px;
  height: 80px;
  background: linear-gradient(165deg, #fff 0%, #f8f4ef 50%, #f0eae2 100%);
  border: 2px solid var(--mood-border);
  border-radius: 0 0 14px 14px;
  border-top: none;
  box-shadow: 0 6px 16px rgba(111, 78, 55, 0.12), inset 0 1px 0 rgba(255,255,255,0.8);
  position: relative;
  overflow: hidden;
}

.anim-cup-espresso {
  margin-top: 8px;
}

.anim-espresso-liquid {
  position: absolute;
  bottom: 0;
  left: 5px;
  right: 5px;
  height: 0;
  background: linear-gradient(180deg, #5d4e37 0%, #4a3728 50%, #3e2723 100%);
  border-radius: 0 0 10px 10px;
  animation: fillEspresso 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.anim-espresso-surface {
  position: absolute;
  bottom: 0;
  left: 5px;
  right: 5px;
  height: 0;
  background: linear-gradient(180deg, rgba(196, 167, 125, 0.4) 0%, transparent 60%);
  border-radius: 0 0 10px 10px;
  animation: fillEspresso 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

@keyframes fillEspresso {
  to { height: 28%; }
}

.anim-latte-wrap {
  position: relative;
}

.anim-milk-stream {
  position: absolute;
  top: -8px;
  left: 50%;
  margin-left: -4px;
  width: 12px;
  height: 0;
  background: linear-gradient(180deg, rgba(255,248,240,0.95) 0%, rgba(245, 230, 211, 0.9) 100%);
  border-radius: 0 0 4px 4px;
  animation: milkStream 1.8s cubic-bezier(0.33, 1, 0.68, 1) forwards;
  box-shadow: 0 0 8px rgba(255,255,255,0.5);
}

@keyframes milkStream {
  to { height: 42px; }
}

.anim-cup-latte {
  margin-top: 8px;
}

.anim-latte-liquid {
  position: absolute;
  bottom: 0;
  left: 5px;
  right: 5px;
  height: 28%;
  background: linear-gradient(180deg, #4a3728 0%, #6f4e37 100%);
  border-radius: 0 0 10px 10px;
}

.anim-latte-liquid::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(180deg, #f5e6d3 0%, rgba(196, 167, 125, 0.7) 40%, transparent 100%);
  border-radius: 0 0 10px 10px;
  animation: fillMilk 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fillMilk {
  from { height: 0; }
  to { height: 120%; }
}

.anim-latte-art-wrap {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.anim-latte-heart {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  transform: scale(0);
  opacity: 0;
  animation: latteArtAppear 0.6s ease-out 1s forwards;
}

@keyframes latteArtAppear {
  to { transform: scale(1); opacity: 0.9; }
}

.anim-final-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.anim-saucer {
  width: 88px;
  height: 14px;
  margin-top: -4px;
  background: linear-gradient(180deg, #f8f4ef 0%, #e8ddd2 100%);
  border: 2px solid var(--mood-border);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(111, 78, 55, 0.1);
}

.anim-cup-final {
  margin-bottom: 0;
}

.anim-final-liquid {
  position: absolute;
  bottom: 0;
  left: 5px;
  right: 5px;
  height: 82%;
  background: linear-gradient(180deg, #f5e6d3 0%, #c4a77d 25%, #8d6e4a 60%, #4a3728 100%);
  border-radius: 0 0 10px 10px;
}

.anim-crema {
  position: absolute;
  bottom: 72%;
  left: 6px;
  right: 6px;
  height: 8px;
  background: linear-gradient(180deg, rgba(245, 230, 211, 0.9) 0%, transparent 100%);
  border-radius: 4px;
}

.anim-steam-wrap {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 36px;
  pointer-events: none;
}

.anim-steam-wisp {
  position: absolute;
  bottom: 0;
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  border-radius: 2px;
  filter: blur(3px);
  animation: steamRise 2s ease-in-out infinite;
}

.anim-steam-1 { left: 2px;  animation-delay: 0s; }
.anim-steam-2 { left: 10px; animation-delay: 0.4s; }
.anim-steam-3 { left: 18px; animation-delay: 0.8s; }

@keyframes steamRise {
  0% { opacity: 0; transform: translateY(0) scaleX(1); }
  25% { opacity: 0.6; transform: translateY(-6px) scaleX(1.1); }
  50% { opacity: 0.4; transform: translateY(-14px) scaleX(0.95) translateX(1px); }
  75% { opacity: 0.2; transform: translateY(-22px) scaleX(1.05) translateX(-1px); }
  100% { opacity: 0; transform: translateY(-28px) scaleX(1); }
}

.mood-result {
  padding: 1.5rem;
  background: var(--mood-bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(111, 78, 55, 0.1);
  animation: resultIn 0.5s ease-out;
}

@keyframes resultIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.mood-result-label {
  font-size: 0.8125rem;
  color: var(--mood-muted);
  margin-bottom: 0.25rem;
}

.mood-result-name {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--mood-highlight);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

/* 咖啡名称花字：手写感字体 + 渐变描边 */
.mood-result-name--flower {
  font-family: "Ma Shan Zheng", "ZCOOL KuaiLe", cursive;
  font-size: 1.75rem;
  font-weight: 400;
  background: linear-gradient(135deg, var(--mood-highlight) 0%, var(--mood-primary) 50%, #8d6e63 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 1px 2px rgba(111, 78, 55, 0.2));
  letter-spacing: 0.08em;
}

/* 氛围动效：随机三种之一 */
.mood-result.mood-result-ambient--1 {
  position: relative;
  overflow: hidden;
}
.mood-result.mood-result-ambient--1::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 30% 30%, rgba(196, 167, 125, 0.08) 0%, transparent 50%);
  animation: ambientGlow 4s ease-in-out infinite;
  pointer-events: none;
}
.mood-result.mood-result-ambient--2 {
  animation: ambientShine 6s ease-in-out infinite;
}
@keyframes ambientShine {
  0%, 100% { box-shadow: 0 4px 20px rgba(111, 78, 55, 0.1); }
  50% { box-shadow: 0 4px 24px rgba(196, 167, 125, 0.2); }
}
.mood-result.mood-result-ambient--3 {
  box-shadow: 0 4px 20px rgba(111, 78, 55, 0.1), 0 0 0 1px rgba(196, 167, 125, 0.15);
  animation: ambientPulse 5s ease-in-out infinite;
}
@keyframes ambientGlow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}
@keyframes ambientPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(111, 78, 55, 0.1), 0 0 0 1px rgba(196, 167, 125, 0.15); }
  50% { box-shadow: 0 6px 28px rgba(111, 78, 55, 0.14), 0 0 0 1px rgba(196, 167, 125, 0.25); }
}

.mood-result-recipe {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--mood-text);
  margin-bottom: 1rem;
}

.mood-result-recipe p { margin: 0.5rem 0; }
.mood-result-recipe ul { padding-left: 1.25rem; }

.mood-result-message {
  padding-left: 0.75rem;
  border-left: 3px solid var(--mood-accent);
  font-size: 0.9375rem;
  color: var(--mood-muted);
  font-style: italic;
}
