:root {
  --frame-blue: #1e5fa8;
  --frame-blue-dark: #123a68;
  --bg: #05070c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: #eee;
  font-family: 'Segoe UI', Arial, sans-serif;
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#game-frame {
  position: relative;
  background: #000;
  border: 6px solid var(--frame-blue);
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

#field {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}

#leg-title {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: clamp(16px, 2.4vw, 30px);
  font-weight: 800;
  color: #f0f0f0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 1px;
  z-index: 5;
}

#controls {
  position: absolute;
  top: 10px;
  left: 16px;
  display: flex;
  gap: 8px;
  z-index: 5;
}

#controls button {
  background: rgba(20, 30, 50, 0.7);
  color: #eee;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}
#controls button:hover { background: rgba(40, 60, 100, 0.85); }

#start-overlay, #winner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 10;
}
#start-overlay.hidden, #winner-overlay.hidden { display: none; }

#start-btn {
  font-size: 28px;
  padding: 16px 48px;
  border-radius: 8px;
  border: none;
  background: #2ecc71;
  color: #06210f;
  font-weight: 700;
  cursor: pointer;
}
#start-btn:hover { background: #3ee081; }

#winner-text {
  font-size: clamp(24px, 5vw, 56px);
  font-weight: 800;
  padding: 20px 40px;
  border-radius: 12px;
}

#bins {
  display: flex;
  gap: 2px;
  height: 140px;
  background: var(--frame-blue-dark);
  border: 6px solid var(--frame-blue);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 4px 4px 0;
}

.bin {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border-radius: 2px 2px 0 0;
  overflow: hidden;
}

.bin-fill {
  width: 100%;
  height: 0%;
  background-color: var(--bin-colour, #888);
  background-image:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.45) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 65%, rgba(0,0,0,0.28) 0 18%, transparent 19%),
    radial-gradient(circle at 65% 15%, rgba(255,255,255,0.3) 0 15%, transparent 16%);
  background-size: 11px 11px, 11px 11px, 7px 7px;
  background-position: 0 0, 5px 6px, 3px 2px;
  transition: height 0.15s ease-out;
}

.bin.eliminated .bin-fill { height: 100% !important; background: #000; }
.bin.eliminated::after {
  content: '\2716';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--frame-blue);
  font-size: 22px;
  font-weight: 900;
}

.bin-count {
  position: absolute;
  bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  z-index: 2;
}
.bin.eliminated .bin-count { display: none; }

.bin-badge {
  position: absolute;
  bottom: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #111;
  border: 2px solid #fff;
  color: #fff;
  font-size: 12px;
  z-index: 3;
}
.bin.complete .bin-badge { display: flex; }

@media (max-width: 700px) {
  #bins { height: 90px; }
  .bin-count { font-size: 9px; }
}
