@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: grid;
  place-items: center;

  background: #151515;
  color: #eeeeee;

  font-family: "Patrick Hand", "Comic Sans MS", system-ui, sans-serif;

  /* 手绘纸张噪点感 */
  background-image:
    radial-gradient(#555 0.7px, transparent 0.7px),
    radial-gradient(#333 0.6px, transparent 0.6px);
  background-size: 19px 19px, 27px 27px;
  background-position: 0 0, 8px 11px;
}

/* 顶部淡淡的手绘纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;

  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      #ffffff 4px
    );

  mask-image: linear-gradient(
    to bottom,
    #000,
    transparent 85%
  );
}

.page-shell {
  width: min(1100px, 100%);
  padding: 26px 20px;
  position: relative;
}

/* =========================
   Header
========================= */

.game-header {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin: 0 4px 18px;
}

.eyebrow {
  color: #999999;

  font: 700 11px "Space Grotesk", sans-serif;
  letter-spacing: .18em;

  margin: 0;
}

h1 {
  margin: 0;

  font-size: clamp(30px, 5vw, 46px);
  letter-spacing: .04em;
  line-height: 1;

  color: #f2f2f2;

  /* 很轻微的手绘错位感 */
  text-shadow:
    1px 1px 0 #555,
    -1px 0 0 #222;
}

.subtitle {
  margin: 0;
  color: #999999;
  font-size: 14px;
}

/* =========================
   Game Frame
========================= */

.game-frame {
  position: relative;

  border-radius: 10px;
  overflow: hidden;

  background: #242424;

  /*
   * 不使用特别规整的阴影，
   * 改成类似手绘边框的感觉
   */
  box-shadow:
    0 18px 45px #000000aa,
    3px 3px 0 #080808,
    -2px -1px 0 #555;

  border: 2px solid #4a4a4a;
}

/* 手绘内框 */
.game-frame::before {
  content: "";
  position: absolute;
  inset: 6px;

  pointer-events: none;
  z-index: 2;

  border: 1px solid #777;
  border-radius: 7px;

  opacity: .45;
}

/* =========================
   Phaser Game
========================= */

#game {
  width: 100%;
  line-height: 0;
}

#game canvas {
  display: block;

  width: 100% !important;
  height: auto !important;

  cursor: crosshair;


}

/* =========================
   Tip
========================= */

.tip {
  position: absolute;

  left: 50%;
  bottom: 17px;

  transform: translateX(-50%);

  background: #1b1b1bd9;
  color: #cfcfcf;

  padding: 7px 15px;

  border: 1px solid #666;
  border-radius: 6px;

  font-size: 12px;

  pointer-events: none;

  transition: opacity .2s;

  /* 手绘纸片效果 */
  box-shadow:
    2px 2px 0 #090909,
    -1px -1px 0 #444;
}

/* =========================
   Result Panel
========================= */

.result-panel {
  position: absolute;
  inset: 0;

  display: grid;
  place-content: center;
  justify-items: center;

  text-align: center;

  padding: 24px;

  background: #161616e8;

  backdrop-filter: grayscale(1) blur(5px);

  transition: opacity .25s;
}

.result-panel.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.result-kicker {
  color: #aaaaaa;

  font: 700 11px "Space Grotesk", sans-serif;
  letter-spacing: .18em;
}

.result-panel h2 {
  margin: 8px 0 4px;

  font-size: 38px;

  color: #f1f1f1;

  text-shadow:
    2px 2px 0 #333,
    -1px -1px 0 #000;
}

.result-panel p {
  color: #bdbdbd;
  margin: 0 0 20px;
}

/* =========================
   Button
========================= */

button {
  color: #151515;

  background: #dedede;

  border: 2px solid #777;

  border-radius: 7px;

  padding: 11px 22px;

  font: 800 15px "Patrick Hand", "Comic Sans MS", sans-serif;

  cursor: pointer;

  /*
   * 手绘按钮：
   * 不做柔和 glow，改成偏硬的纸片阴影
   */
  box-shadow:
    3px 4px 0 #050505,
    -1px -1px 0 #999;

  transition:
    transform .08s ease,
    background .15s ease;
}

button:hover {
  background: #f2f2f2;
  transform: translate(-1px, -1px);
}

button:active {
  transform: translate(2px, 3px);

  box-shadow:
    1px 1px 0 #050505;
}

/* =========================
   Pause Button
========================= */

.pause-button {
  margin-left: auto;

  padding: 8px 14px;

  color: #d0d0d0;

  background: #292929;

  border: 1px solid #666;

  border-radius: 6px;

  box-shadow:
    2px 2px 0 #090909;

  font-size: 13px;
}

.pause-button:hover {
  background: #353535;
  transform: translate(-1px, -1px);
}

.pause-button:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* =========================
   Footer
========================= */

footer {
  display: flex;
  justify-content: space-between;

  gap: 12px;

  color: #777777;

  margin: 14px 5px 0;

  font-size: 12px;
}

footer b {
  color: #bdbdbd;
}

/* =========================
   Mobile
========================= */

@media (max-width: 680px) {

  .page-shell {
    padding: 14px 10px;
  }

  .game-header {
    display: block;

    margin: 4px 5px 15px;
  }

  .eyebrow {
    margin-bottom: 7px;
  }

  .subtitle {
    margin-top: 10px;
  }

  .pause-button {
    position: absolute;

    top: 19px;
    right: 14px;
  }

  footer {
    display: block;
    line-height: 1.9;
  }

  footer span {
    display: block;
  }
}