:root {
  --screen-width: 375px;
  --screen-height: 812px;
  --page-bg: #070707;
  --shadow: rgba(0, 0, 0, 0.38);  
  /* Background scale to avoid visible edges during resizing */
  --bg-scale: 2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page-bg);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  /* Fit to viewport while preserving the original 375x812 aspect ratio */
  width: min(100vw, calc(100vh * 375 / 812));
  aspect-ratio: 375 / 812;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 18px 40px var(--shadow);
  background: #000;
}

.mobile-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #00c8f7;
}

.bg,
.banner,
.title,
.band-bg,
.imprint-text,
.shop-art,
.page-art,
.overlay {
position: absolute;
top: -50px;
left: 0;
display: block;
width: 100%;
height: 100%;
}

/* overlay (e.g. buypage.gif) should sit above page-art */
.overlay {
z-index: 5;
pointer-events: none;
}

.title {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;  
  transform-origin: center top;
}

/* double-scale the page background so edges don't show when resizing */
.bg {
  z-index: 0;
  transform: translateY(var(--move-up)) scale(var(--bg-scale));
  transform-origin: center center;
}

.banner {
  z-index: 2;
}

.title {
  z-index: 2;
}

.bottom-band {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.band-bg {
  z-index: 1;
}

.imprint-row {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.imprint-text {
  z-index: 1;
  pointer-events: none;
}

.imprint-left,
.instagram-link {
  position: absolute;
  top: 85%;
  bottom: 0;
  width: 50%;
  display: block;
  pointer-events: auto;
  background: transparent;
  /* shift overlays up the same amount so hitboxes remain aligned */
  transform: translateY(var(--move-up));
}

.imprint-left {
  left: 0;
}

.instagram-link {
  right: 0;
}

.shop-link {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16%;
  /* keep this as a transparent hitbox that scales with the canvas; height ≈ 27% of 812px (≈220px) */
  height: 27.1%;
  z-index: 5;
  display: block;
  background: transparent;
  border: none;
  box-shadow: none;
  text-decoration: none;
  padding: 0;
  /* shift the hitbox up by the same proportional amount so it lines up with the moved shop art */
  transform: translateY(var(--move-up));
}

.page-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #000;
  padding: 24px;
}

.content-page {
  position: relative;
  /* Make the content page scale exactly like the app-shell so it fits any phone viewport */
  width: min(100vw, calc(100vh * 375 / 812));
  aspect-ratio: 375 / 812;
  background: #00c8f7;
  overflow: hidden;
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.content-page img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  display: block;
  z-index: 1;
}

.back-link {
  position: absolute;
  top: 3%;
  right: 7%;
  left: auto;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  color: #b9ff43;
  text-decoration: none;
  font-family: "Comic Sans MS", "Marker Felt", "Trebuchet MS", cursive;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 2px rgba(185, 255, 67, 0.38);
}

.legal-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  z-index: 2;
  
  backdrop-filter: blur(1px);
  overflow: auto;
  padding: 14px 14px 20px;
}

.legal-list {
  font-family: "Comic Neue", cursive;
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
  font-size: 19px;
  line-height: 1.5;
  color: #ff3dcf;
}

.legal-list a {
  list-style: none;
  color: #b5ff2c;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 19px;
}

@media (max-width: 420px) {
  body {
    padding: 0;
  }

  .app-shell,
  .content-page {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

/* Buy page controls (moveable hitboxes). Keep here so you can edit them centrally in styles.css */

.nav-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16%;
  z-index: 6;
  pointer-events: none; /* allow children to be interactive only */
}

.nav-top a {
  position: absolute;
  top: 19%;
  bottom: 0;
  width: 45%;
  pointer-events: auto;
}

.nav-top .prev { left: 2%; }
.nav-top .next { right: 2%; }

/* bottom buy hitbox */
.buy-bottom,
#buyBtn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 33%;
  z-index: 6;
  pointer-events: auto;
  background: transparent;
}

/* Product image (page-art) -- keep full-canvas behavior like index */
.page-art,
#mainImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transform: scale(1.30);
  object-fit: contain; /* change to cover / none if you prefer different behaviour */
  z-index: 2;
}

/* Debug helper: add `body.classList.add('debug')` in the console to visualize hitboxes */
body.debug .imprint-left,
body.debug .instagram-link,
body.debug .shop-link,
body.debug .prev,
body.debug .next,
body.debug #buyBtn,
body.debug .buy-bottom,
body.debug .nav-top a {
  background: rgba(255, 0, 0, 0.18) !important;
  outline: 2px dashed rgba(255, 0, 0, 0.9) !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06) inset !important;
}

/* show the aria-label of the control for quick identification */
body.debug .imprint-left::after,
body.debug .instagram-link::after,
body.debug .shop-link::after,
body.debug .prev::after,
body.debug .next::after,
body.debug #buyBtn::after,
body.debug .buy-bottom::after,
body.debug .nav-top a::after {
  content: attr(aria-label);
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 12px;
  line-height: 1;
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 2px 6px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 9999;
}

