:root {
  color-scheme: dark;
  background: #000;
}

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  background: #000;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

.menu-pages {
  width: 100%;
  margin: 0 auto;
  background: #000;
}

.menu-page {
  position: relative;
  width: min(100%, 1920px);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  overflow: hidden;
  background: #000;
}

.menu-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.editable-overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.menu-overlay {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  min-height: calc(var(--h) * 1%);
  display: flex;
  align-items: center;
  justify-content: var(--align, flex-start);
  padding: .25em .45em;
  color: var(--color, #fff);
  background: var(--background, transparent);
  font-size: clamp(.48rem, calc(var(--size, 2.2) * 1vw), 2.4rem);
  font-weight: var(--weight, 700);
  line-height: 1.15;
  text-align: var(--text-align, left);
  white-space: pre-line;
}

.page-counter {
  position: fixed;
  z-index: 10;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  padding: .5rem .72rem;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(0, 0, 0, .68);
  color: rgba(255, 255, 255, .86);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

@media (min-aspect-ratio: 4 / 3) {
  .menu-page {
    min-height: 100svh;
    width: min(100vw, 1920px);
    display: grid;
    place-items: center;
  }
}

@media print {
  .page-counter { display: none; }
  .menu-page {
    width: 100%;
    break-after: page;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
