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

body {
  font-family: 'DM Sans', sans-serif;
  background: #f5e6d3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Floral wallpaper background */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(219,112,147,0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(147,197,219,0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(219,200,147,0.08) 0%, transparent 60%);
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4a0b0' fill-opacity='0.08'%3E%3Cpath d='M30 15c-2 0-4 2-4 4s2 5 4 6c2-1 4-3 4-6s-2-4-4-4zm-8 8c-2 0-4 2-4 4s2 5 4 6c2-1 4-3 4-6s-2-4-4-4zm16 0c-2 0-4 2-4 4s2 5 4 6c2-1 4-3 4-6s-2-4-4-4z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
  z-index: 0;
}

#root {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Phone frame */
.phone-frame {
  width: 380px;
  max-width: 96vw;
  height: 720px;
  max-height: 90vh;
  background: #000;
  border-radius: 40px;
  padding: 8px;
  box-shadow:
    0 25px 60px rgba(0,0,0,0.3),
    0 0 0 2px #333,
    inset 0 0 0 1px #555;
  position: relative;
  overflow: hidden;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: #faf7f2;
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Status bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  background: #faf7f2;
  flex-shrink: 0;
}

/* Notch */
.notch {
  width: 120px;
  height: 24px;
  background: #000;
  border-radius: 0 0 16px 16px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Stats bar */
.stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 16px;
  background: linear-gradient(135deg, #fff5f5, #fdf2f8, #f0f7ff);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
  font-size: 13px;
}

/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  scroll-behavior: smooth;
  background: #faf7f2;
}

.chat-area::-webkit-scrollbar {
  width: 3px;
}
.chat-area::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 10px;
}

/* Message bubbles */
.message-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  margin-bottom: 4px;
  line-height: 1.4;
  font-size: 15px;
  animation: messageSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  word-wrap: break-word;
}

.message-grandma {
  background: #e9e9eb;
  color: #1a1a1a;
  border-bottom-left-radius: 6px;
  align-self: flex-start;
  margin-right: auto;
}

.message-player {
  background: linear-gradient(135deg, #007aff, #0062cc);
  color: #fff;
  border-bottom-right-radius: 6px;
  align-self: flex-end;
  margin-left: auto;
}

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

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #e9e9eb;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  width: fit-content;
  margin-bottom: 4px;
  animation: messageSlide 0.3s ease-out;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: #999;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Response buttons */
.response-panel {
  padding: 10px 12px 14px;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.response-btn {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 6px;
  border-radius: 20px;
  border: 2px solid #e8e0d8;
  background: #fff;
  color: #333;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.3;
}

.response-btn:hover {
  border-color: #d4a0b0;
  background: #fdf2f8;
  transform: scale(1.01);
}

.response-btn:active {
  transform: scale(0.98);
  background: #fce7f3;
}

.response-btn:last-child {
  margin-bottom: 0;
}

/* Meters */
.meter-bar {
  height: 8px;
  border-radius: 4px;
  background: #eee;
  overflow: hidden;
  flex: 1;
}

.meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.meter-love .meter-fill {
  background: linear-gradient(90deg, #f472b6, #ec4899);
}

.meter-confusion .meter-fill {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

/* Love meter pulse */
@keyframes lovePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.love-pulse {
  animation: lovePulse 0.6s ease;
}

/* Start screen */
.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px 20px;
  background: linear-gradient(180deg, #fdf2f8 0%, #faf7f2 40%, #f0f7ff 100%);
  text-align: center;
}

.start-title {
  font-family: 'Caveat', cursive;
  font-size: 46px;
  font-weight: 700;
  color: #be185d;
  line-height: 1;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0 rgba(190,24,93,0.1);
}

.start-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: #888;
  margin-bottom: 30px;
  font-weight: 400;
}

.start-btn {
  background: linear-gradient(135deg, #ec4899, #be185d);
  color: #fff;
  border: none;
  padding: 16px 40px;
  border-radius: 30px;
  font-size: 20px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(236,72,153,0.35);
  transition: all 0.2s ease;
  animation: phoneBuzz 2s infinite;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(236,72,153,0.45);
}

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

@keyframes phoneBuzz {
  0%, 90%, 100% { transform: rotate(0deg); }
  92% { transform: rotate(-2deg); }
  94% { transform: rotate(2deg); }
  96% { transform: rotate(-2deg); }
  98% { transform: rotate(2deg); }
}

/* Grandma avatar */
.grandma-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Game over / Victory */
.endscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px 20px;
  text-align: center;
}

.endscreen-victory {
  background: linear-gradient(180deg, #fdf2f8, #fef3c7, #f0fdf4);
}

.endscreen-defeat {
  background: linear-gradient(180deg, #f1f5f9, #e2e8f0);
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(700px) rotate(720deg); opacity: 0; }
}

/* Recipe card */
.recipe-card {
  background: #fffbeb;
  border: 2px dashed #d97706;
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
  max-height: 160px;
  overflow-y: auto;
}

.recipe-card h3 {
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: #92400e;
  margin-bottom: 6px;
}

/* Footer */
.game-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: #999;
  padding-bottom: 16px;
  position: relative;
  z-index: 1;
}

.game-footer a {
  color: #be185d;
  text-decoration: none;
  font-weight: 600;
}

.game-footer a:hover {
  text-decoration: underline;
}

.grandma-name {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 2px;
  margin-left: 42px;
}

.message-group {
  margin-bottom: 10px;
}

/* Phone vibrate on start */
@keyframes phoneVibrate {
  0%, 100% { transform: translateX(0) rotate(0); }
  10% { transform: translateX(-3px) rotate(-0.5deg); }
  20% { transform: translateX(3px) rotate(0.5deg); }
  30% { transform: translateX(-3px) rotate(-0.5deg); }
  40% { transform: translateX(3px) rotate(0.5deg); }
  50% { transform: translateX(0) rotate(0); }
}

.phone-vibrate {
  animation: phoneVibrate 0.5s ease;
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* Score change indicator */
.score-change {
  position: absolute;
  font-size: 14px;
  font-weight: 700;
  animation: scoreFloat 1s ease-out forwards;
  pointer-events: none;
}

@keyframes scoreFloat {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* Cross-stitch decoration */
.cross-stitch {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 12px 0;
  opacity: 0.3;
}

.cross-stitch span {
  font-size: 10px;
}

@media (max-width: 420px) {
  .phone-frame {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
    width: 100vw;
    max-width: 100vw;
    padding: 0;
    box-shadow: none;
  }
  .phone-screen {
    border-radius: 0;
  }
  .notch {
    display: none;
  }
  body {
    justify-content: flex-start;
  }
  .game-footer {
    display: none;
  }
}