* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #1a1626; --card-bg: #fffaf2; --ink: #3b2f3e; --accent: #e0526e;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Courier New", ui-monospace, monospace;
  display: flex; align-items: center; justify-content: center;
}
#app { position: relative; width: 960px; height: 600px; }
canvas {
  display: block; background: #000; image-rendering: pixelated;
  border-radius: 8px; box-shadow: 0 10px 50px rgba(0,0,0,.6);
}
#hud {
  position: absolute; top: 10px; left: 0; right: 0;
  display: flex; justify-content: space-between; padding: 0 18px;
  color: #fff; font-size: 15px; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
#overlay { position: absolute; inset: 0; pointer-events: none; }
#overlay > * { pointer-events: auto; }
.card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: var(--card-bg); color: var(--ink);
  max-width: 520px; padding: 26px 30px; border-radius: 12px;
  border: 2px solid rgba(59,47,62,.25); box-shadow: 0 14px 40px rgba(0,0,0,.55);
  text-align: center; font-size: 17px; line-height: 1.5;
}
.card h1 { font-size: 32px; margin-bottom: 6px; color: var(--accent); letter-spacing: 1px; }
.card h2 { font-size: 21px; margin-bottom: 10px; }
.card .objective {
  display: block; margin: 14px auto 0; max-width: 420px;
  background: #f6e8cf; border: 1px dashed #c9a86a; border-radius: 8px;
  padding: 8px 14px; font-size: 15px;
}
.card button {
  display: block; margin: 18px auto 0; padding: 10px 26px;
  font: inherit; font-weight: bold;
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; cursor: pointer; box-shadow: 0 4px 14px rgba(224,82,110,.45);
}
.card button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(224,82,110,.6); }
.replay-row { margin-top: 14px; font-size: 13px; color: #8a7d8e; }
.replay-row a { color: #a8657a; cursor: pointer; text-decoration: underline; margin: 0 6px; }
.toast {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(20,14,26,.92); color: #fff; padding: 10px 20px;
  border-radius: 8px; font-size: 16px; white-space: nowrap;
}
.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.letter {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 780px; max-height: 560px; overflow-y: auto;
  background: #fdf6e3; color: #4a3b30; padding: 30px 42px;
  border-radius: 4px; box-shadow: 0 12px 40px rgba(0,0,0,.7);
  font-size: 16px; line-height: 1.65; white-space: pre-wrap;
}
.letter h2 { color: #b03a52; margin-bottom: 14px; }
.letter .sign { margin-top: 18px; font-style: italic; text-align: right; }
#too-small { display: none; }
@media (max-width: 990px), (max-height: 630px) {
  #app { display: none; }
  #too-small {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: #fff; text-align: center; font-size: 18px;
    line-height: 1.6; padding: 24px;
  }
}
