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

body {
  background: #1a1008;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  overflow: auto;
}

#wrapper {
  position: relative;
  display: inline-block;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 3px solid #c8a04a;
  box-shadow:
    0 0 0 1px #7a5820,
    0 0 32px rgba(200, 160, 74, 0.35),
    0 0 80px rgba(180, 130, 40, 0.15);
  cursor: none;
}

#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #d4aa50;
  font-size: 11px;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  pointer-events: none;
  line-height: 1.8;
}

#controls-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  color: rgba(212,170,80,0.6);
  font-size: 9px;
  text-align: right;
  pointer-events: none;
  line-height: 2;
}

/* DIALOG BOX */
#dialog {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e150a;
  border: 3px solid #c8a04a;
  box-shadow: 3px 3px 0 #7a5820, inset 0 0 0 1px #3a2a10;
  padding: 10px 18px 10px 12px;
  color: #f0d890;
  font-size: 11px;
  white-space: nowrap;
  display: none;
  pointer-events: none;
  z-index: 10;
  align-items: center;
  gap: 4px;
}

#dialog-portrait {
  width: 22px;
  height: 22px;
  border: 2px solid #7a5820;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

#dialog .blink {
  animation: blink 0.8s step-end infinite;
  color: #d4aa50;
}

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* MODAL OVERLAY */
#modal-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

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

#modal-box {
  background: #1a1208;
  border: 4px solid #c8a04a;
  box-shadow: 6px 6px 0 #7a5820, inset 0 0 0 2px #3a2a10;
  max-width: 720px;
  width: 90%;
  max-height: 85%;
  overflow-y: auto;
  position: relative;
}

#modal-box::-webkit-scrollbar { width: 6px; }
#modal-box::-webkit-scrollbar-track { background: #2a1e0a; }
#modal-box::-webkit-scrollbar-thumb { background: #c8a04a; }

#modal-header {
  background: linear-gradient(135deg, #c8a04a, #a87830);
  color: #1a0e04;
  font-size: 13px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#modal-close {
  background: none;
  border: 2px solid #1a0e04;
  color: #1a0e04;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
}

#modal-close:hover { background: #1a0e04; color: #c8a04a; }

#modal-content {
  padding: 20px;
  color: #e8d4a0;
  font-size: 11px;
  line-height: 2.2;
}

#modal-content h2 {
  color: #d4aa50;
  font-size: 13px;
  margin-bottom: 14px;
  border-bottom: 1px solid #3a2a10;
  padding-bottom: 10px;
}

#modal-content p {
  margin-bottom: 12px;
  color: #c8b880;
}

#modal-content .tag {
  display: inline-block;
  background: #241a08;
  border: 1px solid #c8a04a;
  color: #d4aa50;
  padding: 3px 8px;
  margin: 3px;
  font-size: 9px;
}

#modal-content .section {
  margin-bottom: 14px;
}

#modal-content .project-card {
  border: 2px solid #3a2a10;
  padding: 10px;
  margin-bottom: 8px;
  background: #241a08;
}

#modal-content .project-card h3 {
  color: #e8a050;
  font-size: 11px;
  margin-bottom: 8px;
}

#modal-content a {
  color: #80c0e0;
  text-decoration: none;
}

#modal-content a:hover { color: #d4aa50; }

/* TITLE SCREEN */
#title-screen {
  position: absolute;
  inset: 0;
  background: #0e0a04;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#title-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#title-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

#title-screen h1 {
  color: #d4aa50;
  font-size: 32px;
  text-shadow: 3px 3px 0 #7a5820, 0 0 20px rgba(200,160,60,0.6);
  margin-bottom: 12px;
  animation: glow 2s ease-in-out infinite alternate;
}

#title-screen .sub {
  color: #a08040;
  font-size: 11px;
  margin-bottom: 56px;
}

#title-screen .press {
  color: #d4aa50;
  font-size: 13px;
  animation: blink 1s step-end infinite;
}

#title-screen .version {
  position: absolute;
  bottom: 14px;
  right: 16px;
  color: #5a4020;
  font-size: 9px;
}

@keyframes glow {
  from { text-shadow: 3px 3px 0 #7a5820, 0 0 20px rgba(200,160,60,0.3); }
  to   { text-shadow: 3px 3px 0 #7a5820, 0 0 50px rgba(220,180,80,0.9); }
}
