/* ---------------------------------------------------------
   Run —— 页面外框样式
   只负责页面外框，游戏画面本身由 Canvas 绘制
   --------------------------------------------------------- */

:root {
  --paper: #f4efe2;
  --ink: #2b2b2b;
  --accent: #d95d2a;
  --frame: #2b2b2b;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 28px 20px 40px;
  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--ink);
  font-family: "Courier New", Courier, ui-monospace, monospace;
  letter-spacing: 0.02em;

  background-color: var(--paper);
  /* 淡淡的像素格纹背景，纯 CSS，无图片 */
  background-image:
    linear-gradient(to right, rgba(43, 43, 43, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(43, 43, 43, 0.045) 1px, transparent 1px);
  background-size: 16px 16px;

  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 1000px;
}

.head {
  text-align: center;
  margin-bottom: 18px;
}

.title {
  margin: 0;
  font-size: clamp(24px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  text-shadow: 3px 3px 0 rgba(217, 93, 42, 0.35);
}

.title::before {
  content: ">";
  color: var(--accent);
  margin-right: 6px;
}

.stage {
  position: relative;
  border: 4px solid var(--frame);
  /* 硬阴影，模拟老式掌机的“厚边框” */
  box-shadow: 8px 8px 0 rgba(43, 43, 43, 0.18);
  background: #fbf8f0;
  overflow: hidden;
}

canvas#game {
  display: block;
  width: 100%;
  height: auto;
  /* 放大时保持像素边缘锐利 */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
  cursor: pointer;
}

@media (max-width: 600px) {
  body {
    padding: 18px 12px 28px;
  }

  .stage {
    border-width: 3px;
    box-shadow: 5px 5px 0 rgba(43, 43, 43, 0.18);
  }
}
