:root {
  --ink: #22151b;
  --paper: #fff6dc;
  --line: #5c3442;
  --accent: #f2a65a;
  --accent-2: #70c1b3;
  --shadow: rgba(27, 17, 22, 0.45);
  --pixel-font: "Press Start 2P", "ZCOOL KuaiLe", monospace;
  --cn-font: "ZCOOL KuaiLe", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #19141d;
  color: var(--paper);
  font-family: var(--cn-font);
}

body {
  overflow: hidden;
}

#game-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #19141d;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

#dom-layer,
#scene-transition {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#dom-layer {
  z-index: 20;
}

.dom-player {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  transform-origin: 0 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.dom-player img,
.dom-player canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#scene-transition {
  z-index: 30;
  background: #000;
  opacity: 0;
  transform: scale(1.15);
  transition:
    opacity 0.5s ease,
    transform 0.5s steps(8, end);
}

#scene-transition.is-active {
  opacity: 1;
  transform: scale(1);
}

.pixel-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 14, 22, 0.68);
  pointer-events: auto;
  animation: overlay-fade 160ms ease-out both;
}

.pixel-modal__panel {
  width: min(680px, 94vw);
  border: 4px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--shadow);
  padding: 18px;
  transform-origin: center;
  animation: modal-pop 180ms steps(5, end) both;
}

.pixel-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  font-family: var(--pixel-font);
}

.pixel-modal__header h2 {
  margin: 0;
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.6;
}

.icon-button,
.pixel-link {
  border: 3px solid var(--line);
  background: var(--accent);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--line);
  font-family: var(--pixel-font);
  text-decoration: none;
}

.icon-button {
  width: 40px;
  height: 40px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.pixel-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  font-size: 11px;
}

.pixel-modal iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--line);
  background: #111;
}

.pixel-modal p {
  margin: 10px 0 0;
  font-size: 18px;
  line-height: 1.7;
}

.gallery-page {
  min-height: 100dvh;
  overflow: auto;
  background:
    linear-gradient(rgba(25, 20, 29, 0.78), rgba(25, 20, 29, 0.86)),
    url("../public/assets/closeups/cd-player-closeup.png") center / cover fixed;
}

.gallery-header {
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 14px;
}

.gallery-header h1 {
  margin: 0;
  font-family: var(--pixel-font);
  font-size: clamp(18px, 5vw, 34px);
  line-height: 1.35;
  text-shadow: 4px 4px 0 var(--ink);
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto 40px;
}

.album-card {
  border: 4px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 10px;
}

.album-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  image-rendering: pixelated;
  border: 3px solid var(--line);
  background: #f7e8c4;
}

.album-card h2 {
  margin: 10px 0 2px;
  font-family: var(--pixel-font);
  font-size: 11px;
  line-height: 1.6;
}

@keyframes overlay-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .gallery-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
