* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --head-h: 40px;   /* header with the paccastudio menu item */
  --foot-h: 32px;   /* footer with the paccastudio link; the touch controls sit above it */
}

html, body { height: 100%; }

body {
  background: #000;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Courier New', monospace;
  overflow: hidden;
  user-select: none;
}

/* Header and footer: thin bars in the colours of the game */
.page-bar {
  flex: none;
  height: var(--head-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #0a0a0f;
  border-bottom: 1px solid #1a1a2a;
  color: #6068a0;
  font-size: 12px;
  letter-spacing: 2px;
}
.page-bar.foot {
  height: var(--foot-h);
  border-bottom: 0;
  border-top: 1px solid #1a1a2a;
  justify-content: center;
  font-size: 11px;
  letter-spacing: 1px;
  color: #3a3c55;
}
.game-name { color: #c8cce0; font-weight: bold; letter-spacing: 4px; }
.page-bar a { color: #8890c8; text-decoration: none; }
.page-bar a:hover, .page-bar a:focus-visible { color: #dde0f0; }
.pacca {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #2a2c45;
  border-radius: 6px;
  letter-spacing: 1px;
}
.pacca img { display: block; border-radius: 4px; }
.pacca:hover { border-color: #6068a0; }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

#container {
  position: relative;
  line-height: 0;
}

/* Phones held upright: the 3:2 game sits at the top, with a hint to turn the phone */
.rotate { display: none; }
@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
  .stage { flex-direction: column; justify-content: flex-start; padding-top: 16px; gap: 14px; }
  .rotate { display: block; color: #6068a0; font-size: 12px; letter-spacing: 1px; text-align: center; padding: 0 16px; }
}

#game {
  display: block;
  cursor: crosshair;
  /* Up to 1.5x, 3:2, fitting the space between header and footer */
  width:  min(1440px, 100vw, calc((100vh - var(--head-h) - var(--foot-h)) * 1.5));
  height: min(960px,  calc(100vh - var(--head-h) - var(--foot-h)), calc(100vw / 1.5));
}
@supports (height: 100dvh) {
  #game {
    width:  min(1440px, 100vw, calc((100dvh - var(--head-h) - var(--foot-h)) * 1.5));
    height: min(960px,  calc(100dvh - var(--head-h) - var(--foot-h)), calc(100vw / 1.5));
  }
}

/* CRT scanlines */
#crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.07) 3px,
    rgba(0, 0, 0, 0.07) 4px
  );
}

/* CRT vignette */
#crt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.55) 100%
  );
}
