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

body {
  background: #17211a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  overflow: hidden;
}

#wrap {
  position: relative;
  width: min(98vw, calc(96vh * 16 / 9));
  aspect-ratio: 16 / 9;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.55);
  cursor: none;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Transparent overlay canvas above the menu panel (close-up wasp flybys) */
#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.panel {
  pointer-events: auto;
  background: #f6efdb;
  border: 4px solid #6d4c2b;
  border-radius: 16px;
  padding: 26px 38px;
  max-width: 560px;
  width: 88%;
  text-align: center;
  color: #3c2f1e;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-height: 92%;
  overflow-y: auto;
}

.panel.hidden { display: none; }

.panel h1 {
  font-size: 44px;
  letter-spacing: 2px;
  color: #b5432f;
  text-shadow: 2px 2px 0 #f0c020;
  margin-bottom: 4px;
}

.panel h2 {
  font-size: 30px;
  color: #b5432f;
  margin-bottom: 12px;
}

.tagline {
  font-style: italic;
  color: #6d5a3e;
  margin-bottom: 16px;
}

.howto {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 15px;
}

.key {
  display: inline-block;
  background: #3c2f1e;
  color: #f6efdb;
  border-radius: 6px;
  padding: 1px 8px;
  font-weight: bold;
  font-size: 13px;
}

.tips {
  text-align: left;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 auto 18px;
  max-width: 440px;
  color: #52422c;
}

.tips li { margin-bottom: 3px; }

.panel p { margin-bottom: 14px; line-height: 1.6; }

button {
  font-family: inherit;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(#d95f43, #b5432f);
  border: 3px solid #7d2e20;
  border-radius: 12px;
  padding: 12px 34px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7d2e20;
  transition: transform 0.06s, box-shadow 0.06s;
}

button:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #7d2e20; }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d2e20; }

.record {
  margin-top: 14px;
  font-size: 14px;
  color: #6d5a3e;
}

.board {
  margin: 16px auto 4px;
  max-width: 320px;
}

.board h3 {
  font-size: 15px;
  letter-spacing: 1.5px;
  color: #6d4c2b;
  margin-bottom: 8px;
}

.scores {
  list-style: none;
  text-align: left;
  font-size: 15px;
  max-height: 210px;
  overflow-y: auto;
  border: 2px solid #d9cba8;
  border-radius: 10px;
  padding: 8px 14px;
  background: #fdf8ea;
}

.scores li {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}

.scores li.empty {
  justify-content: center;
  color: #8a795a;
  font-style: italic;
}

.scores li.you {
  background: #f9e9a9;
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: bold;
}

.scores .rank { width: 26px; color: #8a795a; }
.scores .initials { flex: 1; letter-spacing: 3px; font-weight: bold; }
.scores .pts { text-align: right; }

#scoreEntry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

#scoreEntry label { font-size: 15px; }

#initialsInput {
  width: 88px;
  font-family: inherit;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 8px;
  text-align: center;
  text-transform: uppercase;
  color: #3c2f1e;
  background: #fdf8ea;
  border: 3px solid #6d4c2b;
  border-radius: 8px;
  padding: 4px 0 4px 8px;
}

#scoreEntry button {
  font-size: 15px;
  padding: 8px 18px;
}

#scoreEntry button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

#saveResult {
  font-weight: bold;
  color: #2c6e63;
}

#gameOver #retryBtn { margin-top: 14px; }

.newhigh {
  color: #b5432f;
  font-weight: bold;
  font-size: 20px;
  text-shadow: 1px 1px 0 #f0c020;
}
