/* tac-battle.css — ฉากรบแบบแทคติก (FAA.tacbattle) · โหลดหลัง game.css, tac-engine.css, tac-ui.css
   แผง .enc.tac-enc เกาะใต้แถบหัวภารกิจเหมือนเดิม (sticky ใน game.css) · ความสูงคงที่ตาม breakpoint เท่านั้น
   มือถือ: สนามรบเต็มกว้าง (ลำดับเทิร์นมุมซ้ายบน · ปุ่มหมุนกล้องมุมขวาบน · เมนูคำสั่งมุมซ้ายล่าง · ป้ายสถานะมุมขวาล่าง)
           ใต้สนาม = การ์ดฮีโร่ | การ์ดผู้ป่วย แถวเดียว */
.enc.tac-enc {
  display: block; gap: 0; padding: 6px 0 8px; border: 0; border-radius: 0;
  border-bottom: 2px solid #3a2312; box-shadow: inset 0 -1px 0 #e2b54a, 0 3px 0 rgba(20,10,2,.28);
  background: #0c1526;
  background-image: linear-gradient(180deg, #0a1222 0%, #101d33 60%, #16243b 100%);
  animation: none;
}
.tac-enc .tb-inner { max-width: 760px; margin: 0 auto; padding: 0 8px; box-sizing: border-box; }
.tac-enc .tb-stage { position: relative; }
.tac-enc .tb-stage > .tac { border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(226,181,74,.35); }
.tac-enc .tb-ov { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }

/* ---------- HUD ของ C ปรับให้เตี้ย: การ์ดสองใบเรียงแถวเดียว ---------- */
.tac-enc .tb-hud { gap: 6px; }
.tac-enc .tb-hud .tu-hud-side { display: block; }
.tac-enc .tb-hud .tu-hud-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.tac-enc .tb-hud .tu-card { padding: 4px 7px 5px 5px; gap: 6px; }
.tac-enc .tb-hud .tu-card .tu-por { width: 40px; height: 40px; }
.tac-enc .tb-hud .tu-card-head { min-height: 0; }
.tac-enc .tb-hud .tu-job { font-size: .7rem; }
.tac-enc .tb-hud .tu-hud-stage > .tu-order.tu-over { left: 5px; top: 5px; max-width: calc(100% - 100px); }

/* เมนูคำสั่งลอยบนสนาม (มุมซ้ายล่าง) */
.tac-enc .tb-menu { position: absolute; left: 5px; bottom: 5px; z-index: 8; width: 104px; pointer-events: none; transition: opacity .3s; }
.tac-enc .tb-menu.tb-dim { opacity: .38; }
.tac-enc .tb-menu .tu-win-title { min-height: 18px; padding: 1px 8px; font-size: .7rem; }
.tac-enc .tb-menu .tu-win-body { padding: 2px 4px 3px 20px; }
.tac-enc .tb-menu .tu-cmd { border-bottom-width: 1px; }
.tac-enc .tb-menu .tu-cmd-b { min-height: 22px; padding: 0 6px; font-size: .8rem; line-height: 22px; }
.tac-enc .tb-menu .tu-glove { width: 22px; height: 16px; }
.tac-enc .tb-menu .tu-ptr { left: 0; }

/* ป้ายสถานะ (aria-live) มุมขวาล่าง */
.tac-enc .tb-msg { position: absolute; right: 5px; bottom: 5px; z-index: 8; max-width: calc(100% - 118px); pointer-events: none;
  margin: 0; font: 600 .74rem/1.3 var(--fh, Kanit, sans-serif); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #2b1a0c; padding: 3px 8px; border-radius: 4px; border: 1.5px solid #3a2312;
  background: linear-gradient(180deg, #fbf3dd, #ecdcb3); box-shadow: inset 0 0 0 1px #fffaea, 0 2px 0 rgba(20,10,2,.45); }

/* ปุ่มหมุนกล้อง (มุมขวาบน) */
.tac-enc .tb-rot { position: absolute; right: 5px; top: 5px; z-index: 9; display: flex; gap: 4px; }
.tac-enc .tb-rot { gap: 0; }
.tac-enc .tb-rotb { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; cursor: pointer; border: 0; background: none;
  color: #ffe9a8; -webkit-tap-highlight-color: transparent; }
.tac-enc .tb-rotb svg { width: 34px; height: 34px; padding: 7px; box-sizing: border-box; border-radius: 50%; border: 2px solid #3a2312;
  background: radial-gradient(circle at 50% 35%, #2a66b8 0%, #0d3a78 60%, #0a2147 100%);
  box-shadow: inset 0 0 0 1px #e2b54a, 0 2px 0 rgba(10,5,0,.55); }
.tac-enc .tb-rotb:active svg { transform: translateY(1px); box-shadow: inset 0 0 0 1px #e2b54a, 0 1px 0 rgba(10,5,0,.55); }
.tac-enc .tb-rotb:focus-visible { outline: 3px solid #ffcf33; outline-offset: 2px; }

/* ---------- ป้ายลอยบนเวที ---------- */
.tac-enc .tb-badge { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.tac-enc .tb-phone { z-index: 2; }
.tac-enc .tb-phone > svg, .tac-enc .tb-phone > b { position: absolute; }
.tac-enc .tb-phone > svg { width: calc(var(--tw) * .46); height: calc(var(--tw) * .46); left: calc(var(--tw) * -.52); top: calc(var(--tw) * -.5);
  filter: drop-shadow(0 2px 0 rgba(0,0,0,.45)); animation: tbRing .5s ease-in-out infinite alternate; }
.tac-enc .tb-phone > b { left: calc(var(--tw) * -.08); top: calc(var(--tw) * -.47); font: 700 11px/1 var(--fh, Kanit, sans-serif); color: #fff;
  background: #c42c22; border: 1.5px solid #fff; border-radius: 999px; padding: 3px 6px; box-shadow: 0 2px 0 rgba(0,0,0,.4); }
@keyframes tbRing { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
.tac-enc .tb-ambb { z-index: 1; }
.tac-enc .tb-amb { position: absolute; left: 0; top: 0; width: calc(var(--tw) * 4.2); transform: translate(-50%, -59%); }
.tac-enc .tb-flip .tb-amb svg { transform: scaleX(-1); }
.tac-enc .tb-amb svg { display: block; width: 100%; height: auto; overflow: visible; }
.tac-enc .tb-drive .tb-amb { animation: tbDrive 1.25s cubic-bezier(.15,.8,.3,1) both; }
@keyframes tbDrive { from { opacity: 0; transform: translate(-50%, -59%) translate(-38%, -28%); } 25% { opacity: 1; } to { opacity: 1; transform: translate(-50%, -59%); } }
.tac-enc .tb-flip.tb-drive .tb-amb { animation-name: tbDriveF; }
@keyframes tbDriveF { from { opacity: 0; transform: translate(-50%, -59%) translate(38%, -28%); } 25% { opacity: 1; } to { opacity: 1; transform: translate(-50%, -59%); } }
.tac-enc .tb-siren { animation: tbSiren .5s steps(1) infinite; }
@keyframes tbSiren { 50% { filter: hue-rotate(150deg) saturate(1.6) brightness(1.15); } }

/* ---------- ผู้ป่วยหายใจ · เจ็บ · ฟื้น ---------- */
.tac-enc .tac-u-patient .tac-pat { transform-origin: 50% 100%; animation: tbBreath 3.4s ease-in-out infinite; }
@keyframes tbBreath { 0%, 100% { scale: 1 1; } 50% { scale: 1.012 1.045; } }
.tac-enc .tac-pat.tb-hurt { animation: tbHurt .65s ease-out, tbBreath 3.4s ease-in-out infinite; }
@keyframes tbHurt { 0% { filter: none; } 15% { filter: brightness(1.6) sepia(1) hue-rotate(-40deg) saturate(4); } 40% { filter: brightness(1.15) sepia(.6) hue-rotate(-40deg) saturate(3); } 100% { filter: none; } }
.tac-enc .tac-pat.tb-heal { animation: tbHeal .85s ease-out, tbBreath 3.4s ease-in-out infinite; }
@keyframes tbHeal { 25% { filter: drop-shadow(0 0 5px rgba(118,240,160,.95)) brightness(1.15); } 100% { filter: none; } }
.tac-enc .tb-crit .tac-pat { animation: tbBreath 1.6s ease-in-out infinite, tbCrit 1.6s ease-in-out infinite; }
@keyframes tbCrit { 50% { filter: drop-shadow(0 0 4px rgba(255,70,60,.9)); } }

/* เวทีวาบแดงตอนผิดพลาด */
.tac-enc.tb-hit .tb-ov { animation: tbFlash .5s ease-out; }
@keyframes tbFlash { 0% { background: transparent; } 25% { background: radial-gradient(120% 90% at 50% 50%, rgba(255,60,40,.05), rgba(224,40,30,.42)); } 100% { background: transparent; } }

/* ---------- จอแคบมาก (≤ 350) ---------- */
@media (max-width: 350px) {
  .tac-enc .tb-inner { padding: 0 5px; }
  .tac-enc .tb-menu { width: 96px; }
  .tac-enc .tb-menu .tu-cmd-b { font-size: .76rem; min-height: 22px; }
  .tac-enc .tb-menu .tu-win-body { padding-left: 18px; }
  .tac-enc .tb-msg { max-width: calc(100% - 100px); font-size: .68rem; }
  .tac-enc .tb-hud .tu-card .tu-por { width: 32px; height: 32px; }
}
/* ---------- จอกว้าง: คอลัมน์การ์ดด้านข้าง (tacui.hud ใส่คลาส wide เมื่อกล่อง ≥ 680) ---------- */
.tac-enc .tb-hud.wide .tu-hud-cards { grid-template-columns: 1fr; }
.tac-enc .tb-hud.wide .tu-card .tu-por { width: 52px; height: 52px; }

@media (prefers-reduced-motion: reduce) {
  .tac-enc .tac-u-patient .tac-pat, .tac-enc .tac-pat.tb-hurt, .tac-enc .tac-pat.tb-heal, .tac-enc .tb-crit .tac-pat,
  .tac-enc .tb-phone > svg, .tac-enc .tb-siren, .tac-enc .tb-drive .tb-amb, .tac-enc.tb-hit .tb-ov { animation: none; }
  .tac-enc .tb-crit .tac-pat { filter: drop-shadow(0 0 3px rgba(255,70,60,.9)); }
}

/* ---------- กล้อง: เวทีกว้างกว่าช่องมองบนมือถือ แล้วเลื่อนตามเหตุการณ์ ---------- */
.tac-enc .tb-cam { --z: 1; position: relative; overflow: hidden; border-radius: 8px; touch-action: pan-y;
  background: #172133; background-image: radial-gradient(120% 85% at 50% 28%, #46597a 0%, #24304a 48%, #0f1626 100%);
  box-shadow: inset 0 0 0 1px rgba(226,181,74,.35); }
.tac-enc .tb-cam::after { content: ""; position: absolute; inset: 0; z-index: 7; pointer-events: none; border-radius: inherit;
  background: radial-gradient(130% 100% at 50% 45%, transparent 58%, rgba(5,8,20,.4) 100%); box-shadow: inset 0 0 0 1px rgba(226,181,74,.35); }
.tac-enc .tb-cam .tb-stage { will-change: transform; }
.tac-enc .tb-cam .tac { border-radius: 0; box-shadow: none; }
.tac-enc .tb-cam .tac::after { display: none; }
/* รอบ 14 (รวมระบบ): มือถือ แผงรบเกาะจอกินที่น้อยลง — การ์ดเตี้ย รูปหน้าเล็ก ให้เหลือพื้นที่ทำภารกิจ */
@media (max-width: 600px) {
  .tac-enc .tb-hud .tu-card { padding: 2px 6px 3px 4px; }
  .tac-enc .tb-hud .tu-card .tu-por { width: 30px; height: 30px; }
  .tac-enc .tb-hud .tu-card .tu-job, .tac-enc .tb-hud .tu-card .tu-status { display: none; }
  .enc.tac-enc { padding: 4px 0 5px; }
}

/* =====================================================================
   รอบ QA (เกมแทคติกเต็มรูป): กล้องซูม + HUD ไม่ทับสนาม
   มือถือ: [สนาม (ช่องมองสูงคงที่) + การ์ดลอยแถบล่าง] + [แถบคำสั่งแนวนอน]  ≈ 30% ของจอ 844
   จอกว้าง: สนามซ้าย · คอลัมน์ขวา = การ์ด 2 ใบ + เมนูคำสั่งแนวตั้ง
   ===================================================================== */
.tac-enc .tb-cam { height: 236px; cursor: grab; }
.tac-enc .tb-cam:active { cursor: grabbing; }
.tac-enc .tb-cam .tb-stage { position: absolute; left: 0; top: 0; }

/* แถบการ์ดลอยขอบล่างของสนาม (มือถือ) */
.tac-enc .tb-dock { position: absolute; left: 4px; right: 4px; bottom: 4px; z-index: 8; pointer-events: none; }
.tac-enc .tb-dock .tu-hud-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px; }
.tac-enc .tb-dock .tu-card { padding: 2px 6px 3px 3px; gap: 5px; align-items: center; border-radius: 6px;
  background: linear-gradient(180deg, rgba(251,243,221,.94), rgba(236,220,179,.94)); }
.tac-enc .tb-dock .tu-card .tu-por { width: 30px; height: 30px; }
.tac-enc .tb-dock .tu-card .tu-job, .tac-enc .tb-dock .tu-card .tu-st-slot, .tac-enc .tb-dock .tu-lv { display: none; }
.tac-enc .tb-dock .tu-name { font-size: .78rem; line-height: 1.15; }
.tac-enc .tb-dock .tu-stat { gap: 3px; }
.tac-enc .tb-dock .tu-stat-n { font-size: .72rem; min-width: 0; }

/* ลำดับเทิร์นมุมซ้ายบน: ย่อ */
.tac-enc .tb-hud:not(.wide) .tu-hud-stage > .tu-order.tu-over { left: 4px; top: 4px; transform-origin: 0 0; transform: scale(.82); }

/* แถบคำสั่งแนวนอน (มือถือ) — ป้ายคำสั่งของขั้นนี้มีถุงมือชี้ (แบบเมนูเกมแทคติก) */
.tac-enc .tb-hud:not(.wide) .tu-hud-side { display: block; margin-top: 4px; }
.tac-enc .tb-hud:not(.wide) .tb-menu { position: static; width: auto; pointer-events: none; display: flex; align-items: stretch; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-win-title { flex: none; display: flex; align-items: center; min-height: 0; padding: 0 7px; font-size: .68rem; border-radius: 5px 0 0 5px; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-win-title::after { display: none; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-win-body { flex: 1; padding: 2px 3px; min-width: 0; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-cmds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-cmd { border: 0; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-cmd-b { display: flex; flex-direction: row; align-items: center; justify-content: center; min-height: 24px; padding: 0 2px; font-size: .78rem; line-height: 24px;
  border-radius: 4px; white-space: nowrap; color: #6b5a44; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-cmd.on .tu-cmd-b { color: #fff; background: linear-gradient(180deg, #2a66b8, #0d3a78); box-shadow: inset 0 0 0 1px #e2b54a; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-cmd.on .tu-cmd-b::before { content: ""; width: 0; height: 0; margin-right: 4px; flex: none;
  border-left: 6px solid #ffcf33; border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; }
.tac-enc .tb-hud:not(.wide) .tb-menu .tu-ptr { display: none; }

/* ป้ายสถานะ: มือถือซ่อนด้วยสายตา (การ์ด HP + แถบหาอันตรายในขั้นบอกอยู่แล้ว) แต่ยังอ่านออกเสียง */
.tac-enc .tb-hud:not(.wide) .tb-msg { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ปุ่มกล้องสามปุ่ม: ซูม · หมุนซ้าย · หมุนขวา */
.tac-enc .tb-zoomb.out .zv { display: none; }

/* จอกว้าง: เมนูแนวตั้งอยู่คอลัมน์ขวาใต้การ์ด */
.tac-enc .tb-hud.wide .tb-menu { position: static; width: auto; }
.tac-enc .tb-hud.wide .tu-hud-side { display: grid; gap: 8px; }
.tac-enc .tb-hud.wide .tb-menu .tu-cmd-b { min-height: 30px; line-height: 30px; font-size: .9rem; }
.tac-enc .tb-hud.wide .tb-menu .tu-win-body { padding-left: 26px; }
.tac-enc .tb-hud.wide .tb-menu .tu-glove { width: 24px; height: 18px; }

/* ตัวเลข/ข้อความลอยบนเวทีซูม: ไม่โตตาม TW (เดิมใหญ่ทับครึ่งจอ) */
.tac-enc .tac-pop { font-size: 17px !important; -webkit-text-stroke-width: 3px; }
.tac-enc .tac-pop-dmg { font-size: 24px !important; }
.tac-enc .tac-pop-info, .tac-enc .tac-pop-miss { font-size: 15px !important; }
/* รถพยาบาลบนเวทีซูม: ไม่ใหญ่เกินช่องมอง */
.tac-enc .tb-amb { width: calc(var(--tw) * 3.3); max-width: 190px; }

/* จอกว้าง: แผงข้างกระชับให้สูงไม่เกินช่องมอง (เวทีเกาะจอกินที่ ≤ 45% ของจอ 800) */
.tac-enc .tb-inner { max-width: 880px; }
.tac-enc .tb-hud.wide .tu-hud-side { gap: 6px; }
.tac-enc .tb-hud.wide .tu-card { padding: 4px 7px 5px 5px; }
.tac-enc .tb-hud.wide .tu-card .tu-por { width: 44px; height: 44px; }
.tac-enc .tb-hud.wide .tu-card .tu-st-slot { display: none; }
.tac-enc .tb-hud.wide .tb-menu .tu-cmd-b { min-height: 26px; line-height: 26px; font-size: .86rem; }
.tac-enc .tb-hud.wide .tb-menu .tu-win-title { min-height: 20px; }

/* อาการเปลี่ยน: เครื่องหมาย ! สีแดงเหนือผู้ป่วย (แบบไอคอนสถานะในเกมแทคติก) */
.tac-enc .tb-alert { z-index: 3; }
.tac-enc .tb-alert > b { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; font: 800 17px/1 var(--fh, Kanit, sans-serif); color: #fff;
  background: radial-gradient(circle at 40% 35%, #ff6b5e, #c0231a 70%); border: 2px solid #fff; box-shadow: 0 2px 0 rgba(0,0,0,.45);
  animation: tbAlert .9s ease-in-out infinite alternate; }
@keyframes tbAlert { from { margin-top: 0; } to { margin-top: -5px; } }
@media (prefers-reduced-motion: reduce) { .tac-enc .tb-alert > b { animation: none; } }

/* ลูกศรชี้ยูนิตลอยเหนือหัว ไม่แตะผม (สไปรต์ 3D สูงเต็ม S×1.12) */
.tac-enc .tac-mark { margin-top: -7px; }
.tac-enc .tb-cam .tb-stage { transform-origin: 0 0; }
/* เงาสัมผัสพื้นเข้มขึ้นที่แกน ให้ตัวละคร "ยืนบนพื้น" ไม่ลอย (เวทีซูมเห็นชัด) */
.tac-enc .tac-ush { background: radial-gradient(closest-side, rgba(5,5,15,.66), rgba(5,5,15,.36) 48%, rgba(5,5,15,0)); }
.tac-enc .tac-u-patient .tac-ush { background: radial-gradient(closest-side, rgba(5,5,15,.62), rgba(5,5,15,.34) 62%, rgba(5,5,15,0)); }

/* =====================================================================
   รอบ 16f (พี่ทัก 2569-11-06 "ภารกิจ1 ui รกมาก") — ตัดของซ้ำบนแผงเผชิญหน้า · แสดงผลอย่างเดียว ไม่แตะคะแนน/step_events
   - ลำดับเทิร์น (รูปหน้า 3 ใบมุมซ้ายบน): ซ่อน — มีผู้เล่นคนเดียว ไม่ได้บอกอะไรเพิ่ม
   - การ์ดฮีโร่: ซ่อน เหลือการ์ดผู้ป่วยใบเดียว (ค่าความปลอดภัยคือสิ่งที่ต้องดู)
   - แถบ/เมนูคำสั่ง (ประเมิน ตัดสินใจ ปฏิบัติ สื่อสาร): มือถือและจอเตี้ยซ่อน — หัวขั้นบอกอยู่แล้ว (ยังอยู่ใน DOM ให้เทสต์/โปรแกรมอ่านจอ)
   - ปุ่มซูม/หมุนบนเวที: มือถือซ่อน (กล้องตามเหตุการณ์เอง)
   - จอเตี้ย ≤ 720 (โน้ตบุ๊ก/แนวนอน): ช่องมองเตี้ยลง (camGeom ใน tac-battle.js) ให้การ์ดขั้นอยู่ในจอ (ตาม breakpoint เท่านั้น ตามกฎเกาะจอ 13.22)
   ===================================================================== */
.tac-enc .tu-hud-stage > .tu-order { display: none; }
.tac-enc .tb-hud .tu-card.side-ally { display: none; }
.tac-enc .tb-dock .tu-hud-cards { grid-template-columns: minmax(0, 1fr); max-width: 58%; margin-left: auto; }
.tac-enc .tb-hud:not(.wide) .tb-menu { display: none; }
@media (max-width: 760px) { .tac-enc .tb-rot { display: none; } }
@media (max-height: 720px) { .tac-enc .tb-hud.wide .tb-menu { display: none; } }   /* ความสูงช่องมองตั้งใน camGeom() (tac-battle.js) */
