@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Press Start 2P', monospace;
  overflow-x: hidden;
}

.font-pixel {
  font-family: 'Press Start 2P', monospace;
  line-height: 1.6;
}

/* Tamagotchi Device */
.tamagotchi-device {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 50%, #ffa552 100%);
  border-radius: 50% 50% 45% 45% / 40% 40% 35% 35%;
  padding: 30px 20px 40px;
  box-shadow: 
    0 20px 50px rgba(0,0,0,0.5),
    inset 0 -5px 20px rgba(0,0,0,0.2),
    inset 0 5px 20px rgba(255,255,255,0.3);
  position: relative;
  border: 6px solid #d94e20;
}

.tamagotchi-device::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 20px;
  right: 20px;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tamagotchi-header {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  margin-bottom: 15px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.tamagotchi-screen {
  background: linear-gradient(135deg, #8ba888 0%, #9fb89c 50%, #b4ccb0 100%);
  border: 5px solid #2c3e2d;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 
    inset 0 0 30px rgba(0,0,0,0.3),
    0 4px 8px rgba(0,0,0,0.3);
  color: #1a1a1a;
  position: relative;
  overflow: hidden;
}

/* Scanline effect */
.tamagotchi-screen::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.05) 0px,
    rgba(0,0,0,0.05) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

.tamagotchi-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
}

.tamagotchi-button {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  border: 4px solid #1a202c;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 
    0 4px 8px rgba(0,0,0,0.4),
    inset 0 2px 4px rgba(255,255,255,0.2);
  position: relative;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.tamagotchi-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a6678 0%, #3d4758 100%);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 12px rgba(0,0,0,0.5),
    inset 0 2px 4px rgba(255,255,255,0.3);
}

.tamagotchi-button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.4),
    inset 0 2px 4px rgba(0,0,0,0.3);
}

.tamagotchi-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Pixel art image rendering */
.pixel-art {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Pixel glow effect */
.pixel-glow {
  filter: drop-shadow(0 0 2px currentColor);
}

.pixel-text {
  text-shadow: 
    2px 2px 0px rgba(0,0,0,0.3),
    0 0 10px currentColor;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .tamagotchi-device {
    max-width: 350px;
    padding: 25px 15px 35px;
  }
  
  .tamagotchi-button {
    width: 60px;
    height: 60px;
    font-size: 7px;
  }
  
  .tamagotchi-screen {
    padding: 15px;
  }
}

/* Grain/noise texture for retrodiffusion effect */
.tamagotchi-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.6;
}