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

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

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  background: #1a0a2e;
  color: #fff;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  overflow-x: hidden;
}

/* === Color Palette === */
:root {
  --pink: #ff6b9d;
  --hot-pink: #ff2d75;
  --purple: #a855f7;
  --deep-purple: #1a0a2e;
  --dark-purple: #2d1b4e;
  --light-purple: #c084fc;
  --gold: #fbbf24;
  --dungeon-dark: #1c1c2e;
  --dungeon-stone: #4a4a5e;
  --dungeon-brick: #6b5b4f;
  --white: #fff;
  --soft-white: #f0e6ff;
}

/* === Pixel Border Utility === */
.pixel-border {
  border: 4px solid var(--pink);
  box-shadow:
    4px 0 0 0 var(--pink),
    -4px 0 0 0 var(--pink),
    0 4px 0 0 var(--pink),
    0 -4px 0 0 var(--pink),
    4px 4px 0 0 var(--pink),
    -4px -4px 0 0 var(--pink),
    4px -4px 0 0 var(--pink),
    -4px 4px 0 0 var(--pink);
}

.pixel-border-purple {
  border: 4px solid var(--purple);
  box-shadow:
    4px 0 0 0 var(--purple),
    -4px 0 0 0 var(--purple),
    0 4px 0 0 var(--purple),
    0 -4px 0 0 var(--purple),
    4px 4px 0 0 var(--purple),
    -4px -4px 0 0 var(--purple),
    4px -4px 0 0 var(--purple),
    -4px 4px 0 0 var(--purple);
}

/* === Navigation Bar === */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--dark-purple);
  border-bottom: 4px solid var(--purple);
}

.nav-bar a {
  color: var(--soft-white);
  text-decoration: none;
  font-size: 10px;
  padding: 8px 16px;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-bar a:hover,
.nav-bar a.active {
  color: var(--pink);
}

.nav-bar .separator {
  color: var(--purple);
  line-height: 2.4;
  font-size: 10px;
}

/* === Page Container === */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

/* === Headings === */
h1 {
  font-size: 20px;
  color: var(--pink);
  margin-bottom: 24px;
  line-height: 1.6;
}

h2 {
  font-size: 14px;
  color: var(--light-purple);
  margin-bottom: 16px;
  line-height: 1.6;
}

p {
  font-size: 10px;
  line-height: 2;
  color: var(--soft-white);
}

/* === Buttons === */
.pixel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 12px 24px;
  background: var(--hot-pink);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  box-shadow:
    4px 4px 0 0 #b91c5a;
}

.pixel-btn:hover {
  background: var(--pink);
  transform: translate(-2px, -2px);
  box-shadow:
    6px 6px 0 0 #b91c5a;
}

.pixel-btn:active {
  transform: translate(2px, 2px);
  box-shadow:
    2px 2px 0 0 #b91c5a;
}

/* === Input Fields === */
.pixel-input {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 12px 16px;
  background: var(--dark-purple);
  color: var(--soft-white);
  border: 4px solid var(--purple);
  outline: none;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.pixel-input:focus {
  border-color: var(--pink);
}

.pixel-input::placeholder {
  color: #6b5b8e;
  font-size: 9px;
}

/* === Animated Hearts === */
@keyframes float-heart {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-12px) scale(1.1); opacity: 0.8; }
}

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

@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes float-up {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-60px); opacity: 0; }
}

.heart {
  display: inline-block;
  color: var(--hot-pink);
  animation: pulse 1.2s ease-in-out infinite;
}

.heart-float {
  position: absolute;
  color: var(--hot-pink);
  animation: float-heart 3s ease-in-out infinite;
}

/* === Decorative Stars === */
.star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--gold);
  animation: twinkle 2s ease-in-out infinite;
}

/* === Error / Status messages === */
.msg-error {
  color: #ff4444;
  font-size: 9px;
  margin-top: 12px;
  min-height: 20px;
}

.msg-success {
  color: #44ff44;
  font-size: 9px;
  margin-top: 12px;
}

/* === Photo Gallery Grid === */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px;
  padding: 20px;
}

.photo-frame {
  background: var(--dark-purple);
  padding: 12px;
  border: 6px solid var(--dungeon-brick);
  box-shadow:
    inset 0 0 0 3px var(--dungeon-stone),
    6px 6px 0 0 rgba(0,0,0,0.3);
  transition: transform 0.2s;
  position: relative;
}

.photo-frame:hover {
  transform: scale(1.04);
  box-shadow:
    inset 0 0 0 3px var(--dungeon-stone),
    6px 6px 0 0 rgba(0,0,0,0.3),
    0 0 20px rgba(255, 107, 157, 0.3);
}

.photo-frame img {
  width: 100%;
  display: block;
  image-rendering: auto;
}

/* === Game Page === */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 20px;
}

.game-container canvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  max-width: 100%;
  border: 4px solid var(--purple);
}

/* === Touch Controls === */
.touch-controls {
  display: none;
  justify-content: space-between;
  width: 100%;
  max-width: 768px;
  padding: 12px 16px;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.touch-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  width: 60px;
  height: 60px;
  background: rgba(168, 85, 247, 0.4);
  color: #fff;
  border: 3px solid var(--purple);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.touch-dpad {
  display: flex;
  gap: 8px;
}

.touch-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
}

/* === Game Overlay === */
.game-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.game-overlay h2 {
  color: var(--pink);
  margin-bottom: 20px;
}

.game-overlay p {
  margin-bottom: 20px;
}

/* === Responsive === */
@media (max-width: 600px) {
  h1 { font-size: 14px; }
  h2 { font-size: 11px; }
  .nav-bar a { font-size: 8px; padding: 6px 10px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
  .page-container { padding: 24px 12px; }
}
