@font-face {
  font-family: "Press Start 2P";
  src: url("/press-start-2p.woff2") format("woff2");
  font-display: block;
}
:root {
  --ink: #000;
  --paper: #fff;
  --muted: #888;
  --line: #ddd;
  --heart: #e4002b;
  --pixel: "Press Start 2P", system-ui, "Noto Sans TC", "PingFang TC", sans-serif;
  --text: system-ui, -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.75 var(--text);
}
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #bbb; }
a:hover { border-bottom-color: var(--ink); }

/* ---- 標題：WIWI.❤ ---- */
.title {
  font-family: var(--pixel);
  font-weight: normal;
  font-size: clamp(28px, 9vw, 56px);
  line-height: 1;
  margin: 56px 0 0;
  white-space: nowrap;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.title a { border: 0; display: flex; align-items: flex-end; }
.title span {
  display: inline-block;
  animation: hop 2.4s steps(1, end) infinite;
  animation-delay: calc(var(--i) * 0.12s);
}
/* 一格一格地跳：上 1px、上 2px、落下，像 NES 的角色 */
@keyframes hop {
  0%   { transform: translateY(0); }
  4%   { transform: translateY(-0.125em); }
  8%   { transform: translateY(-0.25em); }
  12%  { transform: translateY(-0.125em); }
  16%  { transform: translateY(0); }
  100% { transform: translateY(0); }
}
.title svg {
  width: 0.875em;
  height: 0.75em;
  margin-left: -0.25em;
  margin-bottom: 0.125em;
  display: block;
}
.title .heart {
  animation: beat 1.2s steps(1, end) infinite;
  transform-origin: 50% 60%;
}
@keyframes beat {
  0%   { transform: scale(1); }
  10%  { transform: scale(1.25); }
  20%  { transform: scale(1); }
  30%  { transform: scale(1.15); }
  40%  { transform: scale(1); }
  100% { transform: scale(1); }
}
.subtitle {
  text-align: center;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 20px 0 40px;
}
.subtitle a { color: inherit; }
.subtitle a:hover { color: var(--ink); }

/* ---- 表單 ---- */
.sign {
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 20px;
  margin-bottom: 48px;
}
.sign h2, .entries h2 {
  font-family: var(--pixel);
  font-weight: normal;
  font-size: 12px;
  margin: 0 0 16px;
  letter-spacing: 0.1em;
}
/* 像素字的數字比中文高，往下推到兩者視覺中心對齊 */
.entries h2 .count { position: relative; top: 2px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field label small { font-weight: normal; color: var(--muted); }
.field input, .field textarea {
  width: 100%;
  font: 15px/1.6 var(--text);
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 8px 10px;
}
.field input:focus, .field textarea:focus { outline: 3px solid var(--heart); outline-offset: 0; }
.field textarea { min-height: 120px; resize: vertical; }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; min-width: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note { font-size: 12px; color: var(--muted); margin: 0; }
button, .btn {
  font-family: var(--pixel);
  font-size: 12px;
  line-height: 1;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--heart);
}
button:active { transform: translate(3px, 3px); box-shadow: none; }

/* 送出後的提示：用 #sent 錨點顯示，不需要 JavaScript */
.sent { display: none; border: 3px solid var(--ink); background: #fff4f6; padding: 14px 18px; margin-bottom: 32px; }
.sent:target { display: block; }
.sent strong { font-family: var(--pixel); font-size: 11px; font-weight: normal; color: var(--heart); }

/* ---- 留言 ---- */
.entry { border-top: 2px dashed var(--line); padding: 20px 0; }
.entry:first-of-type { border-top: 0; }
.entry header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.entry .name { font-weight: 700; overflow-wrap: anywhere; }
.entry .who-line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.entry .floor { font-family: var(--pixel); font-size: 10px; color: var(--muted); border: 0; white-space: nowrap; }
.entry .floor:hover { color: var(--heart); }
.entry:target { background: #fff4f6; box-shadow: 0 0 0 8px #fff4f6; }
.entry time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.entry .body { margin-top: 6px; overflow-wrap: anywhere; }
.reply {
  margin: 12px 0 0 16px;
  padding: 10px 14px;
  border-left: 4px solid var(--heart);
  background: #fafafa;
  overflow-wrap: anywhere;
}
.reply-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.reply .who { font-family: var(--pixel); font-size: 10px; color: var(--heart); }
.reply time { font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

footer { text-align: center; font-size: 12px; color: var(--muted); margin: 56px 0 48px; }

@media (max-width: 480px) {
  .row { flex-direction: column; gap: 0; }
  .sign { padding: 16px; box-shadow: 4px 4px 0 var(--ink); }
}

/* ---- 換頁 ---- */
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 32px; }
.pager a, .pager span { min-width: 36px; padding: 6px 10px; text-align: center; border: 2px solid var(--ink); font-size: 14px; line-height: 1.4; }
.pager .cur { background: var(--ink); color: var(--paper); }
.pager a:hover { background: #fff4f6; }
