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

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a6fb5;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Press Start 2P', monospace;
}

#game-container {
  width: 100%;
  height: 100%;
}

#game-container canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ===== MODAL OVERLAY (Retro Pixel Style) ===== */
#modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

#modal-overlay.active {
  display: flex;
}

#modal-container {
  background: #fff8e8;
  max-width: 90vw;
  max-height: 85vh;
  width: 360px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  position: relative;
  border: 4px solid #5a3a2a;
  box-shadow: 6px 6px 0 0 rgba(0, 0, 0, 0.25);
  animation: pixelPop 0.15s steps(3) forwards;
}

@keyframes pixelPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Pixel Close Button */
#modal-close {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #e85a6a;
  border: 2px solid #5a3a2a;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #fff;
  cursor: pointer;
  padding: 5px 7px;
  line-height: 1;
  z-index: 10;
  box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.2);
}

#modal-close:hover {
  background: #ff6a7a;
}

#modal-close:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

/* Modal Title */
.modal-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #5a3a2a;
  margin-bottom: 6px;
  padding-right: 28px;
  line-height: 1.6;
}

.modal-subtitle {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #9a8a7a;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ===== PIXEL CHAT BUBBLES ===== */
.conversation {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.msg {
  display: flex;
  max-width: 85%;
}

.msg-sent {
  align-self: flex-end;
}

.msg-received {
  align-self: flex-start;
}

.bubble {
  padding: 8px 10px;
  border: 2px solid #5a3a2a;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  line-height: 1.8;
  word-wrap: break-word;
}

.msg-sent .bubble {
  background: #6a9aff;
  color: white;
  border-color: #3a5a9a;
  box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.15);
}

.msg-received .bubble {
  background: #f0e8d8;
  color: #3a2a1a;
  border-color: #c4a870;
  box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.1);
}

/* ===== PIXEL PHOTO FRAME ===== */
.photo-frame {
  text-align: center;
  margin: 8px 0;
  border: 4px solid #a0782a;
  padding: 4px;
  background: #c89a3a;
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.2);
}

.photo-frame img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border: 2px solid #8a6820;
  display: block;
  margin: 0 auto;
  image-rendering: auto;
}

.photo-caption {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #6a5a4a;
  text-align: center;
  margin-top: 10px;
  line-height: 1.8;
}

/* ===== PIXEL NOTE/BOTTLE ===== */
.note-content {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  line-height: 2.2;
  color: #4a3a2a;
  padding: 12px;
  background: #f5e8d0;
  border: 2px dashed #c4a060;
}

/* ===== PIXEL SIGN ===== */
.sign-content {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 2;
  color: #5a3a2a;
  text-align: center;
  padding: 16px;
  white-space: pre-line;
  background: #e8c060;
  border: 3px solid #8a6a2a;
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.15);
}

/* ===== VALENTINE OVERLAY ===== */
#valentine-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #ffb6c1 0%, #ff69b4 50%, #ff1493 100%);
  display: none;
  z-index: 2000;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#valentine-overlay.active {
  display: flex;
  animation: valentineFadeIn 2s ease-out;
}

@keyframes valentineFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.valentine-content {
  text-align: center;
  padding: 40px 24px;
  max-width: 500px;
  width: 90vw;
  position: relative;
  z-index: 2;
}

.valentine-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: white;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.2);
  margin-bottom: 32px;
  line-height: 1.8;
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.5s forwards;
}

.valentine-message p {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  line-height: 2.2;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 20px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

.valentine-message p:nth-child(1) { opacity: 0; animation: fadeInUp 1s ease-out 1.5s forwards; }
.valentine-message p:nth-child(2) { opacity: 0; animation: fadeInUp 1s ease-out 2.5s forwards; }
.valentine-message p:nth-child(3) { opacity: 0; animation: fadeInUp 1s ease-out 3.5s forwards; }
.valentine-message p:nth-child(4) { opacity: 0; animation: fadeInUp 1s ease-out 4.5s forwards; }
.valentine-message p:nth-child(5) { opacity: 0; animation: fadeInUp 1s ease-out 5.5s forwards; }

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

.valentine-signoff {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: white;
  margin-top: 32px;
  line-height: 2;
  white-space: pre-line;
  opacity: 0;
  animation: fadeInUp 1s ease-out 6s forwards;
}

.valentine-playlist {
  margin-top: 40px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 7s forwards;
}

.valentine-playlist a {
  display: inline-block;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  line-height: 1.6;
  border: 3px solid rgba(255, 255, 255, 0.5);
  box-shadow: 4px 4px 0 0 rgba(0, 0, 0, 0.15);
  transition: background 0.2s;
}

.valentine-playlist a:hover,
.valentine-playlist a:active {
  background: rgba(255, 255, 255, 0.35);
}

.valentine-playlist a:active {
  box-shadow: none;
  transform: translate(4px, 4px);
}

.valentine-tap-hint {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 48px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 7.5s forwards;
}

/* Floating Hearts */
.hearts-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.float-heart {
  position: absolute;
  bottom: -30px;
  font-size: 24px;
  opacity: 0;
  animation: floatHeart 8s ease-in infinite;
}

@keyframes floatHeart {
  0% { transform: translateY(0) rotate(0deg) scale(0.5); opacity: 0; }
  10% { opacity: 0.7; transform: scale(1); }
  90% { opacity: 0.3; }
  100% { transform: translateY(-110vh) rotate(720deg) scale(0.3); opacity: 0; }
}

/* ===== MUTE BUTTON ===== */
#mute-btn {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 500;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 16px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: none;
}

#mute-btn.visible {
  display: block;
}
