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

html, body {
  height: 100%;
  background: #0B1020;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* HUD */
#hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(162,76,255,0.2);
  flex-shrink: 0;
}
#hud .back-btn {
  color: #a24cff;
  font-size: 1.4rem;
  text-decoration: none;
  line-height: 1;
}
.hud-info {
  display: flex;
  gap: 20px;
  align-items: center;
}
.hud-stat { text-align: center; }
.hud-label { font-size: 0.65rem; color: #a0a0a0; text-transform: uppercase; letter-spacing: 0.05em; }
.hud-value { font-size: 1.1rem; font-weight: 700; color: #fff; }

.hud-found { display: flex; gap: 5px; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #333; border: 2px solid #555; transition: background 0.2s, border-color 0.2s; }
.dot.found { background: #a24cff; border-color: #c87fff; }

/* Main area – fills all remaining vertical space */
#main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px;
  gap: 6px;
}

/* Level info bar */
#level-bar {
  font-size: 0.8rem;
  color: #a0a0a0;
  text-align: center;
  flex-shrink: 0;
}
#level-bar span { color: #a24cff; font-weight: 700; }

/* Game area – two SVG panels side by side, filling all space */
#game-area {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
}

.svg-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.panel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a0a0a0;
  text-align: center;
  flex-shrink: 0;
}
.svg-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  border: 2px solid rgba(162,76,255,0.3);
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  background: #111;
}
.svg-wrapper svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Overlay boxes (found differences) */
.diff-box {
  position: absolute;
  border: 3px solid #a24cff;
  border-radius: 8px;
  pointer-events: none;
  animation: box-in 0.4s ease-out forwards;
}
@keyframes box-in {
  0%   { opacity: 0; transform: scale(0.8); }
  60%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* Miss X */
.miss-x {
  position: absolute;
  color: #ff4444;
  font-size: 1.4rem;
  font-weight: 900;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: miss-fade 0.7s ease-out forwards;
}
@keyframes miss-fade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
}

/* Overlays / Modals */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.overlay.hidden { display: none; }
.overlay-box {
  background: #1a1a2e;
  border: 1px solid rgba(162,76,255,0.4);
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}
.overlay-box h2 { font-size: 1.8rem; margin-bottom: 8px; }
.overlay-box p { color: #a0a0a0; margin-bottom: 20px; }

.btn-primary {
  display: inline-block;
  background: #a24cff;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-primary:hover { background: #8a3de0; }
.btn-ghost {
  display: inline-block;
  background: transparent;
  color: #a24cff;
  border: 2px solid #a24cff;
  border-radius: 8px;
  padding: 9px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  margin-left: 10px;
}
.btn-ghost:hover { background: rgba(162,76,255,0.15); }

/* Mobile – stack vertically, allow scroll */
@media (max-width: 600px) {
  html, body { overflow: auto; height: auto; }
  #main { overflow: auto; }
  #game-area { flex-direction: column; }
  .svg-wrapper { aspect-ratio: 500 / 380; flex: none; }
}
