:root {
  color-scheme: dark;
  --text: #f5edcb;
  --muted: #b9c7e8;
  --gold: #ffd56a;
  --panel: rgba(8, 12, 30, 0.86);
  --panel-line: rgba(130, 161, 255, 0.28);
  --shadow: 0 30px 80px rgba(2, 4, 14, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(81, 121, 255, 0.16), transparent 34%),
    linear-gradient(180deg, #0a1028 0%, #050812 100%);
  color: var(--text);
  font-family: "Chakra Petch", "Segoe UI", sans-serif;
}

body {
  display: flex;
}

.app-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px;
}

body.is-embedded .app-shell {
  width: 100%;
  padding: 0;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #86defc;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0 0 10px;
  color: #fff2bd;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.2rem, 2.7vw, 2.1rem);
  line-height: 1.25;
}

.instructions {
  margin: 0;
  max-width: 780px;
  color: var(--muted);
}

.game-panel {
  position: relative;
  overflow: hidden;
  min-height: 780px;
  border-radius: 28px;
  border: 3px solid rgba(104, 128, 212, 0.35);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, #131b41 0%, #090d20 100%);
  box-shadow:
    var(--shadow),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04),
    inset 0 0 0 10px rgba(7, 9, 20, 0.72);
}

body.is-embedded .game-panel {
  min-height: 100vh;
  border-radius: 0;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 780px;
}

body.is-embedded #gameCanvas {
  height: 100vh;
}

.bottom-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.bottom-bar > .arcade-button {
  width: auto;
  min-width: 180px;
  flex: 0 0 auto;
  align-self: flex-end;
}

.game-panel:has(#startOverlay.is-visible) .bottom-bar {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(760px, 100%);
}

.hud::before {
  content: "";
  left: 18px;
  right: 18px;
  bottom: -10px;
  position: absolute;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 211, 106, 0.08), rgba(255, 211, 106, 0.22), rgba(255, 211, 106, 0.08));
  filter: blur(8px);
  pointer-events: none;
}

.stat-card {
  position: relative;
  min-height: 82px;
  padding: 13px 16px;
  border-radius: 18px;
  border: 2px solid var(--panel-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.2),
    inset 0 0 0 2px rgba(255, 255, 255, 0.025);
}

.progress-card {
  min-width: 0;
}

.life-heart {
  width: 22px;
  height: 22px;
  margin-right: 6px;
  vertical-align: middle;
}

.stat-label,
.result-label {
  display: block;
  margin-bottom: 10px;
  color: #ffe08b;
  font: 400 0.66rem/1.3 "Press Start 2P", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  min-width: 0;
  color: #f8fbff;
  font-size: clamp(1.05rem, 1.8vw, 1.34rem);
  line-height: 1.2;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 16, 0.7);
  backdrop-filter: blur(12px);
}

#startOverlay {
  background: rgba(4, 6, 16, 0.78);
  backdrop-filter: blur(16px);
}

.overlay.is-visible {
  display: flex;
}

.overlay-card {
  width: min(560px, 100%);
  padding: 28px 30px 24px;
  text-align: center;
  border-radius: 28px;
  border: 2px solid rgba(255, 214, 126, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(21, 28, 62, 0.98), rgba(8, 11, 24, 0.98));
  box-shadow:
    0 28px 74px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.overlay-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font: 400 0.78rem/1.35 "Press Start 2P", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overlay-card h2 {
  margin: 0 0 14px;
  color: #fff0b6;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.1rem, 2.6vw, 1.8rem);
  line-height: 1.35;
}

.start-logo {
  display: block;
  width: min(360px, 78%);
  margin: 0 auto 18px;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.34));
}

.overlay-card p {
  max-width: 440px;
  margin: 0 auto 16px;
  color: #dbe4ff;
  line-height: 1.6;
}

.name-entry-form {
  display: grid;
  gap: 16px;
}

.name-entry-input {
  width: 100%;
  min-height: 62px;
  padding: 0 20px;
  border-radius: 18px;
  border: 2px solid rgba(255, 213, 90, 0.52);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    rgba(10, 18, 42, 0.96);
  color: #fff4c8;
  text-align: center;
  text-transform: uppercase;
  font: 700 clamp(1.2rem, 2vw, 1.7rem) / 1 "Press Start 2P", monospace;
  letter-spacing: 0.12em;
}

.name-entry-input:focus {
  outline: 2px solid rgba(255, 213, 90, 0.78);
  outline-offset: 3px;
}

.overlay-list {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0 auto 16px;
  color: #d7ddf3;
  text-align: center;
}

.overlay-list span {
  width: fit-content;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 22px;
}

.results-grid > div {
  padding: 16px 14px;
  border-radius: 18px;
  border: 2px solid rgba(127, 157, 243, 0.24);
  background: rgba(7, 12, 31, 0.68);
}

.results-grid strong {
  color: #fff9da;
  font-size: 1.2rem;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.arcade-button {
  width: 100%;
  min-width: 210px;
  min-height: 52px;
  padding: 0 20px;
  border: 2px solid rgba(98, 57, 9, 0.62);
  border-radius: 10px;
  background: #f3b544;
  color: #331500;
  font: 700 0.96rem/1 "Chakra Petch", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -3px 0 rgba(112, 45, 6, 0.28),
    0 5px 0 rgba(92, 42, 9, 0.88),
    0 10px 18px rgba(0, 0, 0, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.arcade-button:hover,
.arcade-button:focus-visible {
  transform: translateY(-2px);
  outline: none;
  filter: brightness(1.02);
}

.arcade-button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 0 rgba(112, 45, 6, 0.28),
    0 2px 0 rgba(92, 42, 9, 0.88),
    0 8px 14px rgba(0, 0, 0, 0.24);
}

.arcade-button.ghost {
  background: rgba(10, 18, 42, 0.86);
  color: #f7fbff;
  border-color: rgba(178, 205, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 5px 0 rgba(22, 31, 64, 0.92),
    0 10px 18px rgba(0, 0, 0, 0.18);
}

.mobile-blocker {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 10, 22, 0.92);
  backdrop-filter: blur(14px);
}

.mobile-blocker-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  text-align: center;
  border-radius: 24px;
  border: 2px solid rgba(255, 214, 126, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(22, 25, 58, 0.98), rgba(8, 10, 28, 0.98));
  box-shadow:
    0 26px 68px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.mobile-blocker-kicker {
  margin: 0 0 10px;
  color: #ffd879;
  font: 400 0.78rem/1.35 "Press Start 2P", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mobile-blocker-card h2 {
  margin: 0 0 10px;
  color: #fff1ba;
  font-size: clamp(1.5rem, 6vw, 2rem);
  line-height: 1.15;
}

.mobile-blocker-card p:last-child {
  margin: 0;
  color: #cbd3f1;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .mobile-blocker {
    display: flex;
  }

  .app-shell {
    visibility: hidden;
    pointer-events: none;
  }
}
