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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #0f1024 0%, #1a1a2e 100%);
  color: #eee;
  min-height: 100vh;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

#game-container {
  width: 100%;
  max-width: 1240px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 12px;
}

h1 {
  color: #f1c40f;
  font-size: 28px;
  letter-spacing: 4px;
  font-weight: 900;
  text-shadow: 0 2px 0 #c9a30e, 0 4px 10px rgba(241, 196, 15, 0.25);
}

#hud {
  display: flex;
  gap: 10px;
  align-items: center;
}

.stat {
  background: #1f2742;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  min-width: 70px;
  border: 1px solid #2d375c;
}

.stat .label {
  color: #8ea0c9;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat span:last-child {
  font-size: 18px;
  font-weight: bold;
  color: #fff;
}

#restart {
  padding: 12px 20px;
  background: #f1c40f;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: transform 0.1s, background 0.2s;
}

#restart:hover { background: #f39c12; transform: translateY(-1px); }
#restart:active { transform: translateY(0); }

.instructions {
  color: #8ea0c9;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
  max-width: 1000px;
}

#canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

#canvas {
  border: 2px solid #2d375c;
  border-radius: 8px;
  background: #0a0a14;
  display: block;
  max-width: 100%;
  height: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

#message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(15, 16, 36, 0.96);
  color: #f1c40f;
  padding: 36px 64px;
  border-radius: 12px;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  display: none;
  border: 3px solid #f1c40f;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-shadow: 0 2px 8px rgba(241, 196, 15, 0.4);
}

#message.show {
  display: block;
  animation: pop 0.4s ease-out forwards;
}

#message .sub {
  display: block;
  font-size: 14px;
  margin-top: 12px;
  letter-spacing: 2px;
  color: #8ea0c9;
  font-weight: 500;
}

@keyframes pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 16, 36, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid #2d375c;
  display: none;
  pointer-events: none;
}

#toast.show {
  display: block;
  animation: toastFade 1.6s forwards;
}

@keyframes toastFade {
  0%   { opacity: 0; transform: translate(-50%, 10px); }
  10%  { opacity: 1; transform: translate(-50%, 0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
