:root {
  --bg-cream: #FAF7F4;
  --ink-main: #2F2733;
  --ink-soft: #6D6175;
  --ink-muted: #988CA0;
  --rose: #C87D8F;
  --rose-deep: #B26578;
  --lavender: #8E74B3;
  --lavender-soft: #EAE2F8;
  --blush-soft: #F7E2E7;
  --champagne: #F6E9DC;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 14px 38px -14px rgba(120, 94, 132, 0.16);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-cream);
  color: var(--ink-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.font-serif-editorial {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
}

/* Diffused Morandi Ambient Background */
.ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(165deg, #FBF8F5 0%, #F7F2F7 48%, #FAF4F0 100%);
}

.ambient-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(72px);
  opacity: 0.78;
  will-change: transform;
}

.orb-1 {
  width: 340px;
  height: 340px;
  top: -90px;
  left: -80px;
  background: radial-gradient(circle, rgba(232, 215, 246, 0.92) 0%, rgba(232, 215, 246, 0) 72%);
  animation: floatOrbA 18s ease-in-out infinite alternate;
}

.orb-2 {
  width: 360px;
  height: 360px;
  top: 18%;
  right: -120px;
  background: radial-gradient(circle, rgba(246, 214, 223, 0.9) 0%, rgba(246, 214, 223, 0) 72%);
  animation: floatOrbB 22s ease-in-out infinite alternate;
}

.orb-3 {
  width: 380px;
  height: 380px;
  bottom: -110px;
  left: -70px;
  background: radial-gradient(circle, rgba(247, 232, 214, 0.92) 0%, rgba(247, 232, 214, 0) 72%);
  animation: floatOrbA 24s ease-in-out infinite alternate-reverse;
}

.orb-4 {
  width: 280px;
  height: 280px;
  bottom: 12%;
  right: -60px;
  background: radial-gradient(circle, rgba(220, 232, 228, 0.78) 0%, rgba(220, 232, 228, 0) 72%);
  animation: floatOrbB 20s ease-in-out infinite alternate-reverse;
}

.ambient-grain {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes floatOrbA {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(24px, 30px, 0) scale(1.08); }
}

@keyframes floatOrbB {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-26px, 24px, 0) scale(1.06); }
}

/* App Shell */
.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(34px, env(safe-area-inset-bottom));
}

/* Glassmorphism Surfaces */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(145%);
  -webkit-backdrop-filter: blur(20px) saturate(145%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.glass-card-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 42px -16px rgba(120, 94, 132, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Category Tabs */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.cat-pill {
  transition: all 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
}

.cat-pill.active {
  background: linear-gradient(135deg, #4B3B52 0%, #685073 100%);
  color: #FFFDFB;
  border-color: transparent;
  box-shadow: 0 8px 20px -8px rgba(75, 59, 82, 0.52);
}

/* Quiz Card Hover & Press */
.quiz-card {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease;
}

.quiz-card:active {
  transform: scale(0.985);
}

/* Option Button */
.option-btn {
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(226, 214, 232, 0.75);
  box-shadow: 0 6px 18px -10px rgba(120, 94, 132, 0.14);
}

.option-btn:active {
  transform: scale(0.985);
}

.option-btn.selected {
  background: linear-gradient(135deg, rgba(246, 224, 231, 0.92) 0%, rgba(235, 226, 248, 0.92) 100%);
  border-color: rgba(196, 126, 146, 0.72);
  box-shadow: 0 10px 26px -10px rgba(176, 108, 134, 0.34);
  transform: translateY(-1px);
}

.option-btn.selected .option-letter {
  background: linear-gradient(135deg, #C87D8F 0%, #8E74B3 100%);
  color: #FFFFFF;
  border-color: transparent;
}

/* Primary Morandi CTA Button */
.btn-primary-morandi {
  background: linear-gradient(135deg, #C77A8E 0%, #9A78B8 100%);
  color: #FFFFFF;
  box-shadow: 0 12px 28px -10px rgba(164, 108, 148, 0.56);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-primary-morandi:active {
  transform: scale(0.98);
  box-shadow: 0 6px 16px -8px rgba(164, 108, 148, 0.5);
}

.btn-primary-morandi:disabled {
  opacity: 0.72;
}

/* View & Question Animations */
.fade-slide-in {
  animation: fadeSlideIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

.question-enter {
  animation: questionSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes questionSlideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Shimmer Loading for AI Analysis */
.shimmer-line {
  background: linear-gradient(90deg, rgba(226, 214, 232, 0.38) 25%, rgba(255, 255, 255, 0.85) 50%, rgba(226, 214, 232, 0.38) 75%);
  background-size: 200% 100%;
  animation: shimmerMove 1.5s infinite linear;
  border-radius: 999px;
}

@keyframes shimmerMove {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Ingredient Bar Animation */
.ingredient-bar-fill {
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Poster stage uses 100% isolated pure inline RGB/HEX styles in index.html */

/* Archive Inputs */
.archive-input {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(214, 198, 224, 0.85);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.archive-input:focus {
  border-color: #9A78B8;
  box-shadow: 0 0 0 3px rgba(154, 120, 184, 0.14);
}

/* Modal */
.modal-backdrop {
  background: rgba(38, 29, 44, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
