/* Touch controls (js/client/ui/touch.js), created by Input when touch is seen.
   Layout: move stick bottom-left with the wagon buttons (Állj! / Gyí! / Kövess!) above it, the aim stick
   bottom-right with Dobás / Használ to its left and Újratölt / Csere above, Térkép / Menü beside the minimap.
   The top band stays free for the HUD. */

.nf-tc {
  --R: clamp(40px, 12vmin, 62px);         /* stick base radius */
  --big: clamp(58px, 15vmin, 72px);
  --small: clamp(44px, 11vmin, 50px);
  --cart: clamp(46px, 11.5vmin, 54px);
  --pad: 14px;
  --band: calc(var(--st) + 180px);        /* the free top band (HUD) */
  --tc-hot: #ff8a2a;
  --tc-ink: #1c0c04;
  position: fixed; inset: 0; z-index: 20; display: none; pointer-events: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: none; font-family: var(--font-body);
}
#ui .nf-tc, .nf-tc { pointer-events: none; }
.nf-tc.on { display: block; }
.nf-tc.ui { display: none; }

/* ---------- zones */
.tc-zone { position: absolute; top: var(--band); bottom: 0; pointer-events: auto; touch-action: none; }
.tc-left { left: 0; width: 45%; }
.tc-right { right: 0; width: 55%; }

/* ---------- sticks */
.tc-stick { position: absolute; width: calc(var(--R) * 2); height: calc(var(--R) * 2); pointer-events: none; transform: translate(-50%, -50%); transition: opacity 0.18s; }
.tc-stick.rest { transform: none; opacity: 0.42; transition: opacity 0.25s; }
.tc-stick-left.rest { left: calc(var(--sl) + var(--pad) + 6px); bottom: calc(var(--sb) + var(--pad) + 6px); }
.tc-stick-right.rest { right: calc(var(--sr) + var(--pad)); bottom: calc(var(--sb) + var(--pad)); }
.tc-base { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 230, 200, 0.55); background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0 38%, rgba(20, 12, 8, 0.4) 39% 100%); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 18px rgba(0, 0, 0, 0.35); }
.tc-base::before { content: ''; position: absolute; inset: 4%; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.25); }
.tc-stick-right .tc-base::before { inset: 22%; border-color: rgba(255, 90, 60, 0.5); }
.tc-knob { position: absolute; left: 50%; top: 50%; width: calc(var(--R) * 0.86); height: calc(var(--R) * 0.86); border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #fff 0 8%, #e9e0d2 9% 55%, #b5a896 100%); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.tc-stick-right .tc-knob { background: radial-gradient(circle at 35% 30%, #fff 0 8%, #ffb35c 9% 55%, #d9581a 100%); }
.tc-stick.active { opacity: 0.95; }
.tc-stick-left.hot .tc-base { border-color: var(--glow); box-shadow: 0 0 0 2px rgba(255, 210, 120, 0.35), inset 0 0 18px rgba(0, 0, 0, 0.35); }
.tc-stick-right.hot .tc-base { border-color: #ff5a3c; box-shadow: 0 0 0 3px rgba(255, 90, 60, 0.35), inset 0 0 18px rgba(0, 0, 0, 0.35); }
.tc-stick-right.hot .tc-knob { background: radial-gradient(circle at 35% 30%, #fff 0 8%, #ff8a5c 9% 55%, #d63a1a 100%); }
.tc-hint { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 2px #000; white-space: nowrap; }
.tc-stick.active .tc-hint { display: none; }

/* ---------- buttons */
.tc-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; margin: 0; padding: 0;
  border: 2px solid rgba(255, 230, 200, 0.5); border-radius: 50%; background: rgba(20, 12, 8, 0.62); color: #fff; font: inherit;
  pointer-events: auto; touch-action: none; cursor: pointer; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s, background-color 0.12s, border-color 0.12s; -webkit-tap-highlight-color: transparent;
}
.tc-btn:focus { outline: none; }
.tc-btn.down, .tc-btn.tap { transform: scale(0.92); background: rgba(255, 138, 42, 0.92); color: var(--tc-ink); border-color: #fff; }
.tc-glyph { font-size: 1.3em; line-height: 1; font-weight: 800; }
.tc-label { font-weight: 800; font-size: 11px; line-height: 1; letter-spacing: 0.02em; text-transform: uppercase; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6); }
.tc-btn.down .tc-label, .tc-btn.tap .tc-label { text-shadow: none; }

.tc-bigcol { position: absolute; right: calc(var(--sr) + var(--pad) + var(--R) * 2 + 12px); bottom: calc(var(--sb) + var(--pad)); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.tc-big { width: var(--big); height: var(--big); font-size: calc(var(--big) * 0.34); }
.tc-big .tc-label { font-size: 12px; }
.tc-btn.use { background: rgba(127, 211, 255, 0.18); border-color: var(--bottle); }
.tc-btn.throw { border-color: rgba(255, 120, 60, 0.85); }
body:has(.hud-prompt.on) .tc-btn.use { animation: tc-pulse 1.1s ease-in-out infinite; background: rgba(127, 211, 255, 0.42); }
@keyframes tc-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(127, 211, 255, 0.55), 0 3px 10px rgba(0, 0, 0, 0.45); } 50% { box-shadow: 0 0 0 10px rgba(127, 211, 255, 0), 0 3px 10px rgba(0, 0, 0, 0.45); } }

.tc-row { position: absolute; right: calc(var(--sr) + var(--pad)); bottom: calc(var(--sb) + var(--pad) + var(--R) * 2 + 18px); display: flex; gap: 8px; pointer-events: none; }
.tc-small { width: var(--small); height: var(--small); border-radius: 14px; font-size: calc(var(--small) * 0.36); }
.tc-small .tc-label { font-size: 10px; }

/* the wagon: three tall pills above the move stick */
.tc-cartrow { position: absolute; left: calc(var(--sl) + var(--pad)); bottom: calc(var(--sb) + var(--pad) + var(--R) * 2 + 26px); display: flex; gap: 6px; pointer-events: none; }
.tc-btn.tc-cart { width: var(--cart); height: calc(var(--cart) * 0.95); border-radius: 12px; font-size: calc(var(--cart) * 0.3); border-color: rgba(127, 211, 255, 0.6); }
.tc-btn.tc-cart .tc-label { font-size: 11px; }
.tc-btn.tc-cart.cur { background: rgba(127, 211, 255, 0.85); color: #06202e; border-color: #fff; }
.tc-btn.tc-cart.cur .tc-label { text-shadow: none; }

.tc-top { position: absolute; top: calc(var(--st) + 8px); right: calc(var(--sr) + 8px + 96px + 10px); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.tc-mini { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; background: rgba(20, 12, 8, 0.55); border-width: 1px; }
.tc-mini.menu .tc-glyph { font-size: 13px; letter-spacing: -2px; }

/* short landscape phones: the small row goes beside the big column */
@media (orientation: landscape) and (max-height: 430px) {
  .nf-tc { --big: clamp(52px, 15vmin, 62px); --R: clamp(38px, 12vmin, 50px); --cart: clamp(44px, 12vmin, 50px); --band: calc(var(--st) + 150px); }
  .tc-row { right: calc(var(--sr) + var(--pad) + var(--R) * 2 + 12px + var(--big) + 12px); bottom: calc(var(--sb) + var(--pad)); flex-direction: column-reverse; }
  .tc-cartrow { left: calc(var(--sl) + var(--pad) + var(--R) * 2 + 20px); bottom: calc(var(--sb) + var(--pad)); flex-direction: column-reverse; }
  .tc-hint { display: none; }
}
/* portrait phones: the HUD is taller */
@media (orientation: portrait) and (max-width: 600px) {
  .nf-tc { --band: calc(var(--st) + 300px); }
  .tc-top { right: calc(var(--sr) + 8px + 92px + 8px); top: calc(var(--st) + 8px); }
}
@media (min-width: 900px) and (min-height: 600px) { .nf-tc { --pad: 24px; } }
