/* ===== Pixel theme — palette: 3A86FF BDB2FF FFD6E0 FFF4F4 000000 FFFFFF ===== */
:root {
  --pix-blue: #3a86ff;
  --pix-lav: #bdb2ff;
  --pix-pink: #ffd6e0;
  --pix-cream: #fff4f4;
  --pix-ink: #000000;
  --pix-white: #ffffff;
}

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

html, body { min-height: 100%; }

body {
  font-family: "Press Start 2P", monospace;
  background: var(--pix-cream);
  color: var(--pix-ink);
  image-rendering: pixelated;
}

main.pix-bg {
  min-height: 100vh;
  padding: 2rem 1rem;
  background-color: var(--pix-cream);
  background-image:
    linear-gradient(var(--pix-pink) 2px, transparent 2px),
    linear-gradient(90deg, var(--pix-pink) 2px, transparent 2px);
  background-size: 32px 32px;
}

.hidden { display: none !important; }

/* ===== shared pixel pieces ===== */
.pix-box {
  border: 4px solid var(--pix-ink);
  box-shadow: 6px 6px 0 var(--pix-ink);
  background: var(--pix-white);
}
.pix-btn {
  border: 4px solid var(--pix-ink);
  box-shadow: 4px 4px 0 var(--pix-ink);
  padding: 0.9rem 1.2rem;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--pix-ink);
  background: var(--pix-white);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.pix-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--pix-ink); }
.bg-blue { background: var(--pix-blue); }
.bg-pink { background: var(--pix-pink); }
.bg-lav { background: var(--pix-lav); }
.bg-white { background: var(--pix-white); }
.dim { opacity: 0.6; cursor: not-allowed; }
a.pix-btn { text-decoration: none; display: inline-block; }
.pop { animation: pop 0.25s steps(5); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.caret::after { content: "█"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.small-text { font-size: 12px; line-height: 2; }
.tiny-text { font-size: 10px; line-height: 2; }
.link-btn { border: 0; background: none; font-family: inherit; cursor: pointer; text-decoration: underline; margin-top: 1rem; }
.wide { width: 100%; }

/* ===== page 1 : Play ===== */
.music-float { position: fixed; right: 1rem; top: 1rem; z-index: 10; }
.hero {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding-top: 3rem;
  text-align: center;
}
.big-title {
  font-size: 3rem;
  color: var(--pix-blue);
  text-shadow: 4px 4px 0 var(--pix-ink);
}
.game-wrap { width: 100%; }
#game {
  width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border: 4px solid var(--pix-ink);
  box-shadow: 6px 6px 0 var(--pix-ink);
  background: var(--pix-white);
  image-rendering: pixelated;
}
.game-hint { margin-top: 0.75rem; }
#unlocked { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

@media (min-width: 768px) {
  .big-title { font-size: 3.75rem; }
  .small-text { font-size: 14px; }
}

/* ===== page 2 : Letter ===== */
.letter-wrap { max-width: 48rem; margin: 0 auto; display: flex; flex-direction: column; gap: 2rem; }
.letter-title {
  text-align: center;
  font-size: 1.5rem;
  line-height: 1.8;
  color: var(--pix-blue);
  text-shadow: 3px 3px 0 var(--pix-ink);
}
.letter-box { padding: 1.25rem; }

.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.photo { aspect-ratio: 1 / 1; overflow: hidden; padding: 0.5rem; background: var(--pix-lav); transform: rotate(var(--rot)); cursor: pointer; }
.photo img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

.wish-box { background: var(--pix-pink); padding: 1.25rem; }
.wish-title { font-size: 1.125rem; color: var(--pix-blue); }
.wish-title::before { content: ""; }
.wish-box > .tiny-text { margin-top: 0.75rem; }
.wish-table { width: 100%; border-collapse: collapse; margin-top: 1.25rem; text-align: left; }
.wish-table tr { border: 4px solid var(--pix-ink); background: var(--pix-white); }
.wish-table td { padding: 0.5rem; font-size: 10px; line-height: 2; vertical-align: middle; }
.wish-table td:first-child { width: 3rem; border-right: 4px solid var(--pix-ink); text-align: center; }
.wish-table label { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.wish-table input[type="checkbox"] {
  width: 1.25rem; height: 1.25rem; flex-shrink: 0;
  accent-color: var(--pix-blue);
  cursor: pointer;
}
.wish-table .done { text-decoration: line-through; opacity: 0.6; }
.wish-footer { margin-top: 1.5rem; text-align: center; }
.wish-footer .pix-btn, .wish-footer span.pix-btn { display: inline-block; }

@media (min-width: 768px) {
  .letter-title { font-size: 2.25rem; }
  .letter-box { padding: 2rem; }
  .wish-box { padding: 2rem; }
  .wish-title { font-size: 1.25rem; }
  .wish-table td { font-size: 12px; }
  .letter-wrap { padding: 0; }
}

/* ===== photo modal ===== */
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.7);
}
.modal-box { max-width: 28rem; width: 100%; padding: 1rem; }
.modal-box img { width: 100%; image-rendering: pixelated; }
.modal-box p { margin-top: 1rem; }
.modal-box button { margin-top: 1rem; }
