/* 毛手毛腳食堂 — 遊戲殼：全螢幕畫布、防手機誤觸（縮放／下拉重新整理／長按選字）、觸控搖桿與按鈕 */
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; overscroll-behavior: none;
  background: #f5e3c0;
  color: #3b2a22;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
body {
  position: fixed; inset: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background-color: #f5e3c0;
  background-image:
    linear-gradient(90deg, rgba(229, 72, 59, .14) 50%, transparent 50%),
    linear-gradient(rgba(229, 72, 59, .14) 50%, transparent 50%);
  background-size: 64px 64px;
}
#game {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; outline: none;
  touch-action: none;
}
#ui { position: fixed; inset: 0; }
noscript .pp-noscript {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  font-size: 18px; background: #f5e3c0;
}

/* 輸入框仍可選字 */
input, textarea { -webkit-user-select: text; user-select: text; }

/* ---------- 觸控控制 ---------- */
.pp-touch { position: absolute; inset: 0; z-index: 5; pointer-events: none; display: none; }
.pp-touch.is-on { display: block; }
.pp-touch-zone {
  position: absolute; left: 0; top: 0; bottom: 0; width: 50%;
  pointer-events: auto; touch-action: none;
}
.pp-touch-ghost {
  position: absolute; left: calc(env(safe-area-inset-left, 0px) + 9%); bottom: calc(env(safe-area-inset-bottom, 0px) + 13%);
  width: 132px; height: 132px; border-radius: 50%;
  border: 3px dashed rgba(59, 42, 34, .35); background: rgba(255, 250, 240, .22);
  display: grid; place-items: center; transition: opacity .2s;
}
.pp-touch-ghost span { font-family: "Huninn", "Noto Sans TC", sans-serif; font-size: 14px; color: rgba(59, 42, 34, .6); background: rgba(255, 250, 240, .75); padding: 2px 10px; border-radius: 999px; }
.pp-touch-ghost.is-off { opacity: 0; }
.pp-touch-base {
  position: absolute; left: 0; top: 0; width: 132px; height: 132px; margin: -66px 0 0 -66px;
  border-radius: 50%; background: rgba(255, 250, 240, .45); border: 3px solid #3b2a22;
  box-shadow: 4px 4px 0 rgba(59, 42, 34, .5);
  opacity: 0; transition: opacity .12s;
}
.pp-touch-base.is-on { opacity: 1; }
.pp-touch-knob {
  position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #f2b632; border: 3px solid #3b2a22; box-shadow: inset 0 -5px 0 #c98d14, 3px 3px 0 #3b2a22;
  display: grid; place-items: center; color: #fffaf0;
}
.pp-touch-pad {
  position: absolute; right: calc(env(safe-area-inset-right, 0px) + 18px); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  width: 250px; height: 220px; pointer-events: none;
}
.pp-tbtn {
  position: absolute; pointer-events: auto; touch-action: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border-radius: 50%; border: 3px solid #3b2a22; color: #fff;
  font-family: "Huninn", "Noto Sans TC", sans-serif;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), inset 0 3px 0 rgba(255, 255, 255, .35), 4px 4px 0 #3b2a22;
  transition: transform .06s, box-shadow .06s;
  -webkit-user-select: none; user-select: none;
}
.pp-tbtn b { font-weight: 400; font-size: 15px; line-height: 1; text-shadow: 0 2px 0 rgba(59, 42, 34, .45); margin-top: 1px; }
.pp-tbtn svg { filter: drop-shadow(0 1.5px 0 rgba(59, 42, 34, .3)); }
.pp-tbtn.is-down { transform: translate(4px, 4px) scale(.96); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), inset 0 3px 0 rgba(255, 255, 255, .3), 0 0 0 #3b2a22; }
.pp-tbtn.is-grab { right: 0; bottom: 18px; width: 96px; height: 96px; background: #e5483b; }
.pp-tbtn.is-grab b { font-size: 18px; }
.pp-tbtn.is-work { right: 112px; bottom: 0; width: 86px; height: 86px; background: #3fb35a; }
.pp-tbtn.is-work b { font-size: 17px; }
.pp-tbtn.is-dash { right: 104px; bottom: 104px; width: 66px; height: 66px; background: #3b8fe5; }
.pp-tbtn.is-emote { right: 14px; bottom: 132px; width: 66px; height: 66px; background: #fffaf0; color: #3b2a22; }
.pp-tbtn.is-emote b { text-shadow: none; }
.pp-touch-petals { position: absolute; right: 47px; bottom: 165px; width: 0; height: 0; pointer-events: none; transform: translate(var(--fx, 0px), var(--fy, 0px)); }
/* 四句話：按鈕在右下角，往左上打開成兩欄兩排（靠右對齊）；每片的錨點＝那句話的右邊中點 */
.pp-petal {
  position: absolute; left: var(--ax); top: var(--ay); width: 0; height: 0; opacity: 0;
  transform: translate(calc(-1 * var(--ax)), calc(-1 * var(--ay))) scale(.3);
  transition: opacity .12s, transform .2s cubic-bezier(.2, 1.5, .45, 1); transition-delay: calc(var(--i, 0) * 24ms);
}
.pp-petal.is-p1 { --ax: 34px; --ay: -122px; --i: 0; }
.pp-petal.is-p2 { --ax: 34px; --ay: -66px; --i: 1; }
.pp-petal.is-p3 { --ax: -76px; --ay: -66px; --i: 2; }
.pp-petal.is-p4 { --ax: -76px; --ay: -122px; --i: 3; }
.pp-petal span {
  position: absolute; left: 0; top: 0; transform: translate(-100%, -50%); transform-origin: 100% 50%;
  white-space: nowrap; font-family: "Huninn", "Noto Sans TC", sans-serif; font-size: 16px; color: #3b2a22;
  padding: 8px 14px; min-height: 44px; box-sizing: border-box; display: grid; place-items: center;
  background: #fffaf0; border: 3px solid #3b2a22; border-radius: 16px; box-shadow: 3px 3px 0 #3b2a22;
  transition: transform .1s, background-color .1s;
}
.pp-touch-petals.is-on { pointer-events: auto; }
.pp-touch-petals.is-on .pp-petal { opacity: 1; transform: none; pointer-events: auto; }
.pp-touch-petals.is-on .pp-petal span { pointer-events: auto; }
.pp-petal.is-hot span { background: #f2b632; transform: translate(-100%, -50%) scale(1.12); }
.pp-touch-hint {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 170px); transform: translateX(-50%);
  display: none; align-items: center; gap: 8px; pointer-events: auto;
  font-family: "Huninn", "Noto Sans TC", sans-serif; font-size: 16px; white-space: nowrap;
  background: #fff9c9; border: 3px solid #3b2a22; border-radius: 14px; padding: 8px 12px 8px 10px; box-shadow: 4px 4px 0 #3b2a22;
  animation: pp-rot-hint 2.4s ease-in-out infinite;
}
.pp-touch-hint.is-on { display: flex; }
.pp-touch-hint.is-hide { opacity: 0; pointer-events: none; transition: opacity .12s; }
/* 直拿：放在觸控鈕上方（廚房最前排），不擋廚房正中間 */
@media (orientation: portrait) { .pp-touch-hint { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 250px); } }
.pp-touch-hint i { display: grid; place-items: center; width: 28px; height: 28px; margin-left: 4px; border-radius: 50%; border: 2px solid #3b2a22; background: #fffaf0; }
@keyframes pp-rot-hint { 0%, 100% { transform: translateX(-50%) rotate(-1deg); } 50% { transform: translateX(-50%) rotate(1.5deg); } }

/* 矮螢幕（手機橫向）按鈕縮一點但仍 ≥ 64px */
@media (max-height: 430px) {
  .pp-touch-pad { width: 230px; height: 190px; right: calc(env(safe-area-inset-right, 0px) + 12px); bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); }
  .pp-tbtn.is-grab { width: 88px; height: 88px; bottom: 10px; }
  .pp-tbtn.is-work { width: 78px; height: 78px; right: 100px; }
  .pp-tbtn.is-dash { width: 64px; height: 64px; right: 94px; bottom: 90px; }
  .pp-tbtn.is-emote { width: 64px; height: 64px; right: 12px; bottom: 112px; }
  .pp-touch-petals { bottom: 144px; right: 44px; }
  .pp-touch-ghost { width: 112px; height: 112px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10%); }
}
@media (prefers-reduced-motion: reduce) {
  .pp-touch-hint { animation: none; }
}
