html, body {
  margin: 0; height: 100%; background: #000; overflow: hidden;
  touch-action: none; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
* { font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace; }
canvas { position: fixed; inset: 0; display: block; }

#start {
  position: fixed; inset: 0; z-index: 5; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .9s ease;
}
#start .t {
  font-size: clamp(18px, 5.2vw, 30px); font-weight: 600; color: #ffc4e1;
  text-shadow: 0 0 10px #ff4fa3, 0 0 28px #ff2f8f;
  animation: pulse 2.4s ease-in-out infinite;
}
#start.hide { opacity: 0; pointer-events: none; }
@keyframes pulse { 0%,100% { opacity: .45; transform: scale(.97); } 50% { opacity: 1; transform: scale(1); } }

#hint {
  position: fixed; left: 0; right: 0; z-index: 3; pointer-events: none;
  top: calc(3vh + env(safe-area-inset-top));
  text-align: center; padding: 0 20px;
  font-size: clamp(11px, 3.1vw, 14px); color: #ff9fcf;
  opacity: 0; transition: opacity 1.2s ease;
}
#hint.on { opacity: .75; }

#toast {
  position: fixed; left: 50%; z-index: 4; pointer-events: none;
  bottom: calc(64px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  font-size: 13px; color: #bfe2ff; opacity: 0; transition: opacity .4s;
  text-shadow: 0 0 8px #3d8bff;
}
#toast.on { opacity: .9; }

.btn {
  position: fixed; z-index: 4; bottom: calc(8px + env(safe-area-inset-bottom));
  width: 46px; height: 46px; padding: 0; border: 0; background: none;
  color: #ff9fcf; font-size: 22px; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity 1s;
  text-shadow: 0 0 8px #ff4fa3;
}
.btn.on { opacity: .4; pointer-events: auto; }
.btn.on:active { opacity: .9; }
#rain { left: calc(8px + env(safe-area-inset-left)); color: #a9d6ff; text-shadow: 0 0 8px #3d8bff; }
#replay { right: calc(8px + env(safe-area-inset-right)); }
#sound { top: calc(6px + env(safe-area-inset-top)); bottom: auto; right: calc(8px + env(safe-area-inset-right)); font-size: 24px; }
#sound.off { text-decoration: line-through; opacity: .25; }
#reopen { left: 50%; transform: translateX(-50%); font-size: 26px; }

/* ---------- pink pixel popup ---------- */
@font-face { font-family: "Pix"; src: url("fonts/pixelify-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pix"; src: url("fonts/pixelify-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
#pop {
  --dark: #b8336a; --mid: #ee5694; --light: #f9b3cf; --pale: #fbd3e2; --cream: #fff3ee; --ink: #6e2a45;
  position: fixed; z-index: 6; left: 50%; bottom: calc(5vh + env(safe-area-inset-bottom));
  width: min(80vw, 330px); box-sizing: border-box;
  background: var(--pale); padding: 6px;
  border: 4px solid var(--dark);
  box-shadow: inset 0 0 0 3px var(--light), 6px 6px 0 rgba(255, 79, 154, .25);
  clip-path: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px));
  transform: translate(-50%, 0) scale(0); opacity: 0; pointer-events: none;
  image-rendering: pixelated;
}
#pop, #pop * { font-family: "Pix", ui-monospace, monospace; }
#pop.open { animation: popIn .45s steps(6) forwards; pointer-events: auto; }
#pop.closing { animation: popOut .25s steps(4) forwards; }
@keyframes popIn { 0% { transform: translate(-50%, 0) scale(.2); opacity: 0; } 60% { transform: translate(-50%, 0) scale(1.06); opacity: 1; } 100% { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes popOut { from { transform: translate(-50%, 0) scale(1); opacity: 1; } to { transform: translate(-50%, 0) scale(.2); opacity: 0; } }
#pop .ico { display: inline-block; line-height: 0; }
#pop .ico svg { width: 100%; height: 100%; display: block; }
.p-title { display: flex; align-items: center; gap: 8px; background: var(--mid); border: 3px solid var(--dark); padding: 5px 6px; }
.p-title .ico { width: 24px; height: 24px; }
.p-name { flex: 1; color: #fff; font-size: 18px; font-weight: 700; letter-spacing: 1px; text-shadow: 2px 2px 0 var(--dark); }
.p-btn { width: 24px; height: 24px; padding: 0; background: var(--light); border: 3px solid var(--dark); color: var(--dark); font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1; }
.p-btn:active { background: #fff; }
.p-menu { margin-top: 5px; display: flex; gap: 18px; background: var(--light); border: 3px solid var(--dark); padding: 3px 10px; color: var(--ink); font-size: 14px; }
.p-body { margin-top: 5px; background: var(--cream); border: 3px solid var(--dark); padding: 10px 16px; min-height: 0; color: var(--ink); font-size: clamp(17px, 4.8vw, 21px); line-height: 1.3; }
.p-body .ln { min-height: 1.1em; white-space: pre-wrap; }
.p-body .ln:empty, .p-body .ln.blank { min-height: .6em; }
.p-body .ln.face { font-family: system-ui, sans-serif; margin-top: 4px; }
.caret { display: inline-block; color: var(--mid); animation: blink 1s steps(1) infinite; margin-left: 1px; }
.p-tools { margin-top: 5px; display: flex; align-items: center; gap: 12px; background: var(--light); border: 3px solid var(--dark); padding: 5px 8px; }
.tool { width: 30px; height: 30px; padding: 0; background: none; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tool .ico { width: 24px; height: 24px; }
.tool:active { transform: translateY(2px); }
.tool-a { font-size: 25px; font-weight: 700; color: var(--mid); -webkit-text-stroke: 1.5px var(--dark); }
.p-from { margin-left: auto; font-size: 12px; color: var(--ink); opacity: .8; }
.p-foot { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.avatar { width: 42px; height: 42px; background: #52d0f5; border: 3px solid var(--dark); display: flex; align-items: center; justify-content: center; flex: none; }
.avatar .ico { width: 30px; height: 28px; }
.p-arrow { color: var(--ink); font-size: 16px; }
.p-date { flex: 1; background: var(--cream); border: 3px solid var(--dark); padding: 6px 10px; color: var(--ink); font-size: 14px; white-space: nowrap; }
.p-date b { color: var(--mid); font-weight: 700; }
