body {
  background: #edede9;
  color: white;
  font-family: 'Raleway';
  text-align: center;
  margin: 0;
}

/* Main game section */
.game-section {
  padding: 30px 20px;
  background-color: #2b2d42;
  position: relative;
  width: 90%;
  max-width: 1100px; /* medium size container */
  margin: 50px;   /* center horizontally */
  text-align: center;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  box-sizing: border-box;
}

/* Title */
.game-title {
  font-size: 2em;
  font-weight: bold;
  color: #fff;
  margin-bottom: 20px;
}

/* Canvas responsive */
#gameCanvas {
  display: block;
  margin: 15px auto 20px auto;
  border: 3px solid #333;
  border-radius: 8px;
  background: linear-gradient(#2c2c2c 0%, #444 100%);
  max-width: 100%;  /* responsive scaling */
  height: auto;
}

/* Overlay */
#overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.85);
  font-size: 56px;
  color: white;
  z-index: 10;
}
#overlay button {
  margin-top: 20px;
  padding: 10px 20px;
  font-size: 22px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(120deg, #16a085 0%, #16a085 50%, #e63946 50%);
  background-size: 200% 100%;
  background-position: left;
  color: white;
  font-weight: bold;
  transition: background-position 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

#overlay button:hover {
  background-position: right;  /* slide effect */
  transform: translateY(-3px); /* lift up */
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}


/* HUD */
#hud {
  position: absolute;
  left: 12px;
  top: 8px;
  font-family: 'Raleway';
  font-size: 18px;
  color: white;
  pointer-events: none;
}

/* Controls */
.controller {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 200px;
  margin: 10px auto 20px auto;
}
.controller button {
  width: 100%;
  height: 30px;
  font-size: 18px;
  border-radius: 10px;
  border: none;
  background: #333;
  color: white;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}
.controller button:active {
  background: #666;
}

/* Boost Button */
.boost-control button {
  width: 100%;
  max-width: 250px;
  padding: 10px 20px;
  font-size: 1em;
  border-radius: 6px;
  cursor: pointer;
  background: #333;
  color: white;
  border: none;
}
.boost-control button:active {
  background: #666;
}

/* Mobile tweaks */
@media (max-width: 768px) {
  #overlay {
    font-size: 32px;
  }
  #overlay button {
    font-size: 18px;
    padding: 8px 16px;
  }
  .controller button {
    height: 45px;
    font-size: 16px;
  }
}
    .container{
      max-width:1100px;
      width:100%;
      display:grid;
      grid-template-columns: 1fr 320px;
      gap:24px;
      align-items:start;
    }

    .diagram-card{
      background:var(--panel);
      border-radius:12px;
      box-shadow:0 6px 18px rgba(16,24,40,0.06);
      padding:18px;
    }

    .image-wrap{
      position:relative;
      width:100%;
      overflow:hidden;
      border-radius:10px;
      background:linear-gradient(180deg,#fff, #f6f7fb);
    }

    .image-wrap img{
      width:100%;
      height:auto;
      display:block;
      user-select:none;
    }

    .marker{
      --size:36px;
      position:absolute;
      width:var(--size);
      height:var(--size);
      border-radius:50%;
      background:var(--accent);
      color:white;
      display:flex;
      align-items:center;
      justify-content:center;
      font-weight:700;
      box-shadow:0 6px 14px rgba(107,70,255,0.18);
      cursor:pointer;
      transform:translate(-50%,-50%);
      transition:transform .15s ease, box-shadow .15s ease;
      border:4px solid rgba(255,255,255,0.6);
    }
    .marker:hover{ transform:translate(-50%,-50%) scale(1.08); }
    .marker.active{ box-shadow:0 10px 28px rgba(107,70,255,0.28); transform:translate(-50%,-50%) scale(1.12); }

    /* Popup */
    .info-popup {
      position: absolute;
      top: -120%;
      left: 50%;
      transform: translate(-50%, 0) scale(0.95);
      background: #fff;
      border-radius: 10px;
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
      padding: 10px;
      width: 140px;
      text-align: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease, transform 0.25s ease;
      z-index: 100;
    }

    .marker:hover .info-popup {
      opacity: 1;
      transform: translate(-50%, -10px) scale(1);
      pointer-events: auto;
    }

    .info-popup img {
      width: 140px;
      height: 80px;
      border-radius: 8px;
      object-fit: cover;
      margin-bottom: 6px;
    }

    .info-popup .title {
      font-weight: 600;
      font-size: 14px;
      color: var(--text);
    }

    .info-popup .category {
      font-size: 12px;
      color: var(--muted);
    }

    .legend{
      background:var(--panel);
      border-radius:12px;
      padding:18px;
      box-shadow:0 6px 18px rgba(16,24,40,0.06);
      max-height:80vh;
      overflow:auto;
    }
    .legend h3{ margin:0 0 12px 0; font-size:18px; }
    .legend-list{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:8px; }
    .legend-item{
      display:flex; gap:10px; align-items:center;
      padding:10px; border-radius:8px; cursor:pointer;
      transition:background .12s ease;
    }
    .legend-item:hover{ background:#fbf8ff; }
    .legend-item .badge{
      width:36px; height:36px; border-radius:50%;
      background:var(--accent); color:#fff;
      display:flex; align-items:center; justify-content:center; font-weight:700;
      flex:0 0 36px;
    }
    .legend-item .meta{ display:flex; flex-direction:column; }
    .legend-item .meta .title{ font-weight:600; font-size:14px; }
    .legend-item .meta .desc{ font-size:12px; color:var(--muted); }

    .caption{ margin-top:10px; color:var(--muted); font-size:13px; }

    @media (max-width:960px){
      .container{ grid-template-columns: 1fr; }
      body{ padding:14px; }
    }