/* ตุ๊กตุ๊กซิ่ง (2026-11-14, phase 32): the start card and the full-screen play
   layer. The start card and the pause card use the site's theme tokens; the
   HUD sits on the game's own canvas, so it keeps its own white-on-shadow look. */

/* ---------- start card ---------- */
.tt-start .cc-body { justify-items: center; text-align: center; gap: 12px; padding-top: 20px; }
.tt-hero { position: relative; width: 132px; height: 104px; }
.tt-hero-tuk { position: absolute; left: 0; bottom: 0; width: 104px; height: 104px; }
.tt-hero-mali { position: absolute; right: 0; top: 0; width: 56px; height: 56px; animation: ttBob 1.6s ease-in-out infinite; }
@keyframes ttBob { 50% { transform: translateY(-4px) rotate(-4deg); } }
.tt-say { margin: 0; font-weight: 700; line-height: 1.6; max-width: 30em; }
.tt-best { margin: 0; color: var(--muted, #6b655c); font-size: .95rem; }
.tt-best b { color: var(--text, #111111); font-variant-numeric: tabular-nums; }
.tt-go {
  min-height: 56px; min-width: 200px; padding: 10px 28px; border: 0; border-radius: 999px; cursor: pointer;
  background: #ff4b2b; color: #111111; touch-action: manipulation;
  font: 700 1.25rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
  box-shadow: 0 4px 0 var(--ink-sh, #111111);
}
.tt-go:active { transform: translateY(3px); box-shadow: none; }
.tt-go:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
.tt-hint-s { margin: 0; color: var(--muted, #6b655c); font-size: .9rem; line-height: 1.6; }
.tt-hint-s small { font-size: .8rem; }

/* ---------- play layer ---------- */
.tt-play {
  position: fixed; inset: 0; z-index: 2147482000;
  background: #2f3034; overflow: hidden;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.tt-play[hidden] { display: none; }
#ttCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.tt-hud {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  pointer-events: none; color: #fff;
  font-family: "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
  text-shadow: 0 2px 0 rgba(17, 17, 17, .55), 0 0 10px rgba(17, 17, 17, .35);
}
.tt-fl { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding-top: 10px; font-weight: 700; font-size: 1.1rem; }
.tt-fl svg { filter: drop-shadow(0 1px 0 rgba(17, 17, 17, .5)); }
.tt-m { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.tt-m b { font-size: 2.6rem; line-height: 1.1; font-weight: 700; letter-spacing: .01em; }
.tt-m small { font-size: 1rem; font-weight: 700; }
.tt-btns { justify-self: end; display: inline-flex; gap: 6px; pointer-events: auto; }
.tt-ib {
  width: 44px; height: 44px; border-radius: 14px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(17, 17, 17, .38); color: #fff; touch-action: manipulation;
}
.tt-ib:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }

.tt-toast {
  position: absolute; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 64px); z-index: 2;
  margin: 0; padding: 6px 16px; border-radius: 999px; transform: translateX(-50%);
  background: #1f7a4d; color: #fff; border: 2px solid #fff;
  font: 700 1.05rem/1.5 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.tt-toast.on { opacity: 1; }
.tt-toast small { font-weight: 600; opacity: .85; margin-left: 6px; }

.tt-hint {
  position: absolute; left: 50%; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 4px); z-index: 2;
  margin: 0; padding: 8px 16px; border-radius: 999px; transform: translateX(-50%);
  background: rgba(17, 17, 17, .55); color: #fff; white-space: nowrap;
  font: 700 .95rem/1.5 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.tt-hint.on { opacity: 1; }

.tt-count {
  position: absolute; inset: 0; z-index: 3; margin: 0;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  color: #fff; font: 700 5rem/1 "Chakra Petch", Inter, system-ui, sans-serif;
  text-shadow: 0 4px 0 rgba(17, 17, 17, .6);
}
.tt-count[hidden] { display: none; }

.tt-pause {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(17, 17, 17, .45);
}
.tt-pause[hidden] { display: none; }
.tt-pause-card {
  width: min(100%, 320px); padding: 20px 18px; border-radius: 22px; text-align: center;
  display: grid; gap: 12px; justify-items: center;
  background: var(--surface, #faf8f3); color: var(--text, #111111);
  border: 1px solid var(--edge, rgba(17, 17, 17, .08));
}
.tt-pause-t { margin: 0; font: 700 1.4rem/1.3 "Chakra Petch", Inter, "SukhumvitSet", system-ui, sans-serif; }
.tt-pause-card .tt-go { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  .tt-hero-mali { animation: none; }
  .tt-toast, .tt-hint { transition: none; }
}

/* ---------- 3D (2026-11-16): words that pop over the tuk-tuk, the debug panel ---------- */
.tt-pop {
  position: absolute; z-index: 2; margin: 0; pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -100%);
  font: 700 1.5rem/1 "Chakra Petch", "SukhumvitSet", system-ui, sans-serif;
  color: #ffd23f; -webkit-text-stroke: 5px #111111; paint-order: stroke fill;
  animation: ttPop .9s cubic-bezier(.2, .9, .3, 1.3) forwards;
}
@keyframes ttPop {
  0% { transform: translate(-50%, -60%) scale(.4); opacity: 0; }
  18% { transform: translate(-50%, -110%) scale(1.15); opacity: 1; }
  32% { transform: translate(-50%, -120%) scale(1); }
  75% { opacity: 1; }
  100% { transform: translate(-50%, -190%) scale(.96); opacity: 0; }
}
.tt-dbg {
  position: absolute; left: 8px; top: 84px; z-index: 5; margin: 0; padding: 6px 8px; border-radius: 8px;
  background: rgba(0, 0, 0, .55); color: #fff; font: 12px/1.45 ui-monospace, Menlo, monospace; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .tt-pop { animation-duration: .6s; animation-timing-function: ease-out; }
}
