:root {
  color-scheme: dark;
  --ink: #05070e;
  --panel: #07172a;
  --cyan: #10e7ff;
  --cyan-soft: #59f4ff;
  --gold: #ffd23f;
  --magenta: #ff3fd7;
  --red: #ff4d4d;
  --green: #52ff86;
  --white: #f8fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100vh;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(5, 7, 14, 0.86), rgba(4, 11, 22, 0.98)),
    url("assets/background-panel.png") center / 320px 267px repeat;
  color: var(--white);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.cabinet {
  width: min(100vw, 820px);
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: clamp(10px, 2vw, 20px);
}

.scoreboard,
.statusbar {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto minmax(92px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px clamp(10px, 2vw, 18px);
  border: 2px solid rgba(16, 231, 255, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 22, 40, 0.94), rgba(4, 10, 23, 0.96)),
    url("assets/ui-panel.png") center / cover no-repeat;
  box-shadow:
    0 0 16px rgba(16, 231, 255, 0.34),
    inset 0 0 20px rgba(22, 106, 195, 0.24);
}

.stat {
  display: grid;
  gap: 2px;
  text-transform: uppercase;
}

.stat:last-child {
  text-align: right;
}

.stat span,
.mode {
  color: var(--cyan-soft);
  font-size: clamp(0.72rem, 1.7vw, 0.84rem);
  font-weight: 800;
}

.stat strong {
  color: var(--gold);
  font-size: clamp(1.15rem, 3.3vw, 1.85rem);
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 210, 63, 0.68);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  color: var(--white);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  font-size: clamp(0.82rem, 2.8vw, 1.2rem);
}

.brand img {
  width: clamp(24px, 6vw, 38px);
  aspect-ratio: 1;
  object-fit: contain;
}

.brand img:last-child {
  filter: drop-shadow(0 0 10px rgba(255, 63, 215, 0.7));
}

.game-shell {
  position: relative;
  width: 100%;
  min-height: 0;
  align-self: center;
  max-height: calc(100vh - 218px);
  display: grid;
  place-items: center;
  border: 3px solid rgba(16, 231, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 20, 37, 0.76), rgba(1, 5, 13, 0.94)),
    url("assets/generated-arcade-sprite-sheet-transparent.png") center / min(88vw, 680px) auto no-repeat;
  box-shadow:
    0 0 30px rgba(16, 231, 255, 0.28),
    0 18px 60px rgba(0, 0, 0, 0.42),
    inset 0 0 42px rgba(41, 246, 255, 0.12);
  overflow: hidden;
}

canvas {
  display: block;
  width: min(100%, calc((100vh - 226px) * 0.92));
  max-width: 100%;
  aspect-ratio: 644 / 700;
  image-rendering: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  background: rgba(2, 5, 12, 0.48);
  transition: opacity 180ms ease;
}

.overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(92%, 390px);
  display: grid;
  justify-items: center;
  gap: 13px;
  padding: 24px 20px 22px;
  border: 2px solid rgba(255, 210, 63, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 18, 34, 0.96), rgba(3, 8, 18, 0.98)),
    url("assets/ui-panel.png") center / cover no-repeat;
  box-shadow:
    0 0 22px rgba(255, 210, 63, 0.28),
    inset 0 0 24px rgba(16, 231, 255, 0.16);
}

.modal-icon {
  width: clamp(70px, 18vw, 106px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(255, 210, 63, 0.62));
}

.modal h1 {
  margin: 0;
  max-width: 100%;
  color: var(--gold);
  font-size: clamp(1.35rem, 6vw, 2.45rem);
  line-height: 1.04;
  text-align: center;
  text-transform: uppercase;
  text-shadow:
    0 0 10px rgba(255, 210, 63, 0.8),
    0 0 20px rgba(255, 63, 215, 0.42);
}

.modal p {
  margin: 0;
  max-width: 31ch;
  color: #d7fbff;
  font-size: clamp(0.92rem, 3vw, 1rem);
  line-height: 1.42;
  text-align: center;
}

#startButton {
  min-width: 142px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 18px 9px 12px;
  border: 2px solid rgba(16, 231, 255, 0.7);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(8, 37, 68, 0.98), rgba(6, 18, 38, 0.98));
  color: var(--white);
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 900;
  box-shadow:
    0 0 15px rgba(16, 231, 255, 0.3),
    inset 0 0 14px rgba(255, 210, 63, 0.18);
}

#startButton:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

#startButton img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.statusbar {
  grid-template-columns: 1fr auto 1fr;
}

.lives,
.fruit-rack {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lives img {
  width: clamp(24px, 6vw, 36px);
  aspect-ratio: 1;
  object-fit: contain;
}

.mode {
  justify-self: center;
  text-align: center;
  text-transform: uppercase;
  min-width: 74px;
}

.fruit-rack {
  justify-content: flex-end;
}

.fruit-rack img {
  width: clamp(25px, 6vw, 38px);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 0 9px rgba(82, 255, 134, 0.42));
}

@media (max-width: 560px) {
  .cabinet {
    gap: 8px;
    padding: 8px;
  }

  .scoreboard,
  .statusbar {
    gap: 6px;
    padding: 8px;
  }

  .brand {
    gap: 5px;
  }

  .brand span {
    max-width: 9ch;
    line-height: 1.05;
  }

  .game-shell {
    max-height: calc(100vh - 156px);
  }

  canvas {
    width: min(100%, calc((100vh - 164px) * 0.92));
  }

  .modal {
    padding: 20px 16px 18px;
  }
}
