* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: Arial, Helvetica, sans-serif;
  color: #e7e2d6;

  background-image:
    linear-gradient(rgba(4, 7, 14, 0.5), rgba(4, 7, 14, 0.55)),
    url("BG.gif");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

.game-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(800px, 92vw); /* WIDTH: increase/decrease this to resize the panel */
  padding: 22px 60px;
  background: rgba(6, 10, 18, 0.4); /* TRANSPARENCY: lower the last value (alpha) = more see-through */
  border: 1px solid rgba(224, 150, 100, 0.25);
  border-radius: 6px;
}

.title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #e69a5c;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* --- Scoreboard --- */
.hud {
  display: flex;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  max-width: 640px;
  background: rgba(8, 12, 22, 0.75);
  border: 1px solid rgba(224, 150, 100, 0.25);
  border-radius: 3px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.95rem;
}

.hud-item {
  padding: 8px 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #b9c4d6;
  border-right: 1px solid rgba(224, 150, 100, 0.2);
}

.hud-item span {
  color: #e69a5c;
  font-weight: bold;
  margin-left: 6px;
}

.hud-item.fps {
  margin-left: auto;
  border-right: none;
  color: #6e7e94;
  font-size: 0.85rem;
}

.hud-item.fps span {
  color: #9fb6d6;
}

/* --- Cabinet / stage --- */
.stage-wrapper {
  position: relative;
  background: #0c1320;
  border: 6px solid #08101c;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

#stage {
  position: relative;
  width: 640px;
  height: 480px;
  background: #0a0e1a;
  overflow: hidden;
}

/* Bricks sit in a static grid, laid out once and never moved */
#bricks {
  position: absolute;
  top: 40px;
  left: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 0 16px;
}

.brick {
  height: 22px;
  border-radius: 2px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  background: #2e4368; /* fallback / row 1: night blue */
  transition: opacity 0.15s linear, transform 0.15s linear;
}

.brick:nth-child(n + 9):nth-child(-n + 16) { background: #93577c; }   /* row 2: dusk pink */
.brick:nth-child(n + 17):nth-child(-n + 24) { background: #cf7f4e; }  /* row 3: campfire orange */
.brick:nth-child(n + 25):nth-child(-n + 32) { background: #c2b08a; }  /* row 4: sand */

.brick.broken {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

/* These two move every frame: own GPU layer via will-change + translate3d,
   so animating them never repaints the bricks or background. */
#ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f0793a;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25), 0 0 5px rgba(240, 121, 58, 0.5);
  will-change: transform;
}

#paddle {
  position: absolute;
  left: 0;
  bottom: 16px;
  width: 90px;
  height: 14px;
  border-radius: 3px;
  background: #e0813f;
  box-shadow: inset 0 1px 0 rgba(255, 210, 170, 0.35), 0 0 6px rgba(224, 129, 63, 0.45);
  will-change: transform;
}

/* --- Overlays: start / game-over / win / pause --- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background: rgba(6, 9, 16, 0.92);
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #e69a5c;
}

.overlay.game-over h2 {
  color: #d8654f;
}

.overlay.win h2 {
  color: #cdbd80;
}

.overlay p {
  max-width: 360px;
  margin: 0 0 20px;
  color: #b9c0cc;
  line-height: 1.5;
}

.overlay button {
  padding: 10px 26px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a1408;
  background: #e0813f;
  border: none;
  border-bottom: 3px solid #a85d28;
  border-radius: 3px;
  cursor: pointer;
}

.overlay button:hover {
  background: #e89657;
}

.overlay button:focus-visible {
  outline: 2px solid #f5c08a;
  outline-offset: 2px;
}

.overlay button:active {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

.pause-buttons {
  display: flex;
  gap: 10px;
}

.hint {
  font-size: 0.8rem;
  color: #98a0ad;
  letter-spacing: 0.5px;
}
