/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink-50: #fff5f7;
  --pink-100: #ffe4ec;
  --pink-200: #ffc9d8;
  --pink-300: #ffa3bd;
  --pink-400: #ff7a9c;
  --pink-500: #ff5c83;
  --pink-600: #f03e6a;
  --rose-grad: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
  --warm-grad: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
  --card-bg: #ffffff;
  --text-primary: #3d2b3d;
  --text-secondary: #8a7080;
  --shadow-soft: 0 8px 32px rgba(255, 92, 131, 0.12);
  --shadow-hover: 0 12px 40px rgba(255, 92, 131, 0.2);
  --radius: 20px;
  --radius-sm: 12px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  background: linear-gradient(135deg, #fff0f3 0%, #fce4ec 30%, #f3e5f5 70%, #ede7f6 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== Stage / Main Container ===== */
.stage {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ===== Decorative Petals ===== */
.petal {
  position: fixed;
  font-size: 1.8rem;
  opacity: 0.35;
  pointer-events: none;
  animation: floatPetal 6s ease-in-out infinite;
  z-index: 0;
}

.petal-one {
  top: 8%;
  left: 8%;
  animation-delay: 0s;
  color: #ff8fab;
}

.petal-two {
  top: 15%;
  right: 10%;
  animation-delay: 1.5s;
  color: #c8a2d4;
}

.petal-three {
  bottom: 12%;
  left: 12%;
  animation-delay: 3s;
  color: #ffb3c6;
}

@keyframes floatPetal {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.35;
  }
  50% {
    transform: translateY(-18px) rotate(15deg);
    opacity: 0.55;
  }
}

/* ===== Card Base ===== */
.stage > section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-soft);
  text-align: center;
  position: relative;
  z-index: 1;
  transition: opacity var(--transition), transform var(--transition);
  animation: cardEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Hidden Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Headings ===== */
h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ===== Avatar ===== */
.avatar {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--pink-100);
  border: 3px solid var(--pink-200);
  box-shadow: 0 4px 16px rgba(255, 92, 131, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.answer-avatar {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== Badge ===== */
.badge {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

/* ===== Buttons ===== */
.actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
}

.yes-btn {
  background: linear-gradient(135deg, #ff6b8a 0%, #ff5c83 100%);
  color: #fff;
  border: none;
  padding: 14px 36px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(255, 92, 131, 0.35);
  font-family: inherit;
}

.yes-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(255, 92, 131, 0.45);
}

.yes-btn:active {
  transform: translateY(0) scale(0.98);
}

.no-btn {
  background: #f5f0f2;
  color: var(--text-secondary);
  border: 2px solid #e8dfe3;
  padding: 14px 36px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  position: relative;
}

.no-btn:hover {
  border-color: var(--pink-300);
  color: var(--pink-500);
}

/* "No" button runs away */
.no-btn.runaway {
  position: fixed !important;
  z-index: 9999;
  transition: all 0.3s ease !important;
}

.primary-btn {
  background: linear-gradient(135deg, #ff6b8a 0%, #ff5c83 100%);
  color: #fff;
  border: none;
  padding: 14px 40px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(255, 92, 131, 0.3);
  font-family: inherit;
  margin-top: 8px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 92, 131, 0.4);
}

.primary-btn:active {
  transform: translateY(0);
}

/* ===== Date Form ===== */
.date-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
}

.date-form label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}

.date-form label span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.date-form input[type="date"],
.date-form select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #f0e0e6;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #fdf8fa;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.date-form input[type="date"]:focus,
.date-form select:focus {
  outline: none;
  border-color: var(--pink-400);
  box-shadow: 0 0 0 4px rgba(255, 122, 156, 0.15);
}

.date-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ff5c83' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

.date-form button {
  align-self: center;
}

/* ===== Food Card ===== */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.food-option {
  background: #fdf8fa;
  border: 2px solid #f5e8ed;
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  font-size: 1.6rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}

.food-option span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.food-option:hover {
  border-color: var(--pink-300);
  background: var(--pink-50);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(255, 92, 131, 0.12);
}

.food-option:hover span {
  color: var(--pink-500);
}

.food-option.selected {
  border-color: var(--pink-500);
  background: var(--pink-100);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(255, 92, 131, 0.2);
}

.food-option.selected span {
  color: var(--pink-600);
  font-weight: 600;
}

/* ===== Custom Food Form ===== */
.custom-food {
  margin-top: 16px;
  animation: cardEnter 0.4s ease;
}

.custom-food label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
  text-align: left;
}

.custom-food-row {
  display: flex;
  gap: 10px;
}

.custom-food-row input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #f0e0e6;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #fdf8fa;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.custom-food-row input:focus {
  outline: none;
  border-color: var(--pink-400);
  box-shadow: 0 0 0 4px rgba(255, 122, 156, 0.15);
}

.custom-food-row button {
  white-space: nowrap;
  padding: 12px 20px;
  font-size: 0.9rem;
}

/* ===== Answer Card ===== */
.answer-card {
  animation: cardEnter 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#summaryText {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ===== Date Menu ===== */
.date-menu {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  background: linear-gradient(135deg, #fff5f7 0%, #fce4ec 100%);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  margin-bottom: 20px;
}

.date-menu > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.date-menu span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--pink-400);
  text-transform: uppercase;
}

.date-menu strong {
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== Heart Row ===== */
.heart-row {
  font-size: 1.2rem;
  color: var(--pink-300);
  letter-spacing: 6px;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ===== Notify Status ===== */
.notify-status {
  display: none;
  margin-top: 16px;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: cardEnter 0.4s ease;
}

.notify-status.notify-sending,
.notify-status.notify-success,
.notify-status.notify-error {
  display: flex;
}

.notify-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.notify-sending {
  background: #f0f0f5;
  color: var(--text-secondary);
}

.notify-sending .notify-dot {
  background: #b0a0b0;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.notify-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.notify-success .notify-dot {
  background: #4caf50;
}

.notify-error {
  background: #fff3e0;
  color: #e65100;
}

.notify-error .notify-dot {
  background: #ff9800;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .stage {
    padding: 24px 16px 40px;
  }

  .stage > section {
    padding: 28px 20px;
  }

  h1 {
    font-size: 1.35rem;
  }

  h2 {
    font-size: 1.15rem;
  }

  .actions {
    flex-direction: column;
    gap: 12px;
  }

  .yes-btn, .no-btn {
    width: 100%;
  }

  .food-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .custom-food-row {
    flex-direction: column;
  }

  .date-menu {
    flex-direction: column;
    gap: 16px;
  }

  .date-menu > div {
    flex-direction: row;
    justify-content: space-between;
  }
}
