/*
  arena.css — คอลัมน์หอคอยเป็นแท็บแฟ้ม Tower | Arena (5 ต.ค. จ๊อบ) + ฉาก Arena
  กฎแท็บก๊อปจากแท็บคอลัมน์คน (ui2.css / ui2_round.css) เปลี่ยนเป็น #col-tower ให้หน้าตาเหมือนกันทุกจุด
*/
  body[data-zone] main > section#col-tower { border: 0 !important; border-image: none !important; box-shadow: none !important; padding: 0 !important; background: none !important; }
body[data-zone] #col-tower .tabs { display: flex !important; align-items: flex-end; gap: 2px !important; padding: 0 4px !important; margin: 0 0 -6px !important;
                    border: 0 !important; position: relative; z-index: 2; flex-wrap: nowrap !important; }
body[data-zone] #col-tower .tabs .tab {
  --tab: url(../assets/ui/v2/tab_off_ice.png); position: relative; box-sizing: border-box; flex: 1 1 auto !important; height: 26px; padding: 0 !important; margin: 0 0 6px !important;
  white-space: nowrap; cursor: pointer; font: 12px/1 var(--pix) !important; letter-spacing: 0 !important; text-transform: none !important; color: #9fbad2 !important;
  text-shadow: 1px 1px 0 #02060c; background: none !important; box-shadow: none !important; outline: none !important; border-radius: 0 !important;
  border-style: solid !important; border-width: 6px 6px 0 !important; border-color: transparent !important;
  border-image: var(--tab) 3 fill / 6px 6px 0 6px stretch !important; image-rendering: pixelated;
  display: inline-flex !important; align-items: center; justify-content: center; }
body[data-zone] #col-tower .tabs .tab:hover { color: #eef7fd !important; }
body[data-zone] #col-tower .tabs .tab.on { --tab: url(../assets/ui/v2/panel_ice.png); height: 32px; margin-bottom: 0 !important; padding-bottom: 4px !important; color: #eef7fd !important; }
body[data-zone] #col-tower .tabs .tab.on::before, body[data-zone] #col-tower .tabs .tab.on::after { content: ''; position: absolute; bottom: 0; width: 6px; height: 6px;
  background: url(../assets/ui/v2/tabjoin_l_ice.png) 0 0 / 6px 6px; image-rendering: pixelated; }
body[data-zone] #col-tower .tabs .tab.on::before { left: -6px; }
body[data-zone] #col-tower .tabs .tab.on::after { right: -6px; background-image: url(../assets/ui/v2/tabjoin_r_ice.png); }
body[data-zone="desert"] #col-tower .tabs .tab { --tab: url(../assets/ui/v2/tab_off_desert.png); color: #d2b98e !important; }
body[data-zone="desert"] #col-tower .tabs .tab.on { --tab: url(../assets/ui/v2/panel_desert.png); color: #fbf3e4 !important; }
body[data-zone="desert"] #col-tower .tabs .tab.on::before { background-image: url(../assets/ui/v2/tabjoin_l_desert.png); }
body[data-zone="desert"] #col-tower .tabs .tab.on::after { background-image: url(../assets/ui/v2/tabjoin_r_desert.png); }
body[data-zone] #col-tower .tabs .tab .ico, body[data-zone] #col-tower .tabs .tab .twi, body[data-zone] #col-tower .tabs .tab span { display: none !important; }
body[data-zone] #col-tower .tab-page { position: relative; z-index: 1; box-sizing: border-box; padding: 10px 8px !important;
  border-style: solid; border-width: 6px; border-image: url(../assets/ui/v2/panel_ice.png) 3 fill / 6px stretch; image-rendering: pixelated; box-shadow: 0 4px 0 rgba(0,0,0,.45); }
body[data-zone="desert"] #col-tower .tab-page { border-image-source: url(../assets/ui/v2/panel_desert.png); }
body[data-zone] #col-tower .tab-page.hidden { display: none !important; }
body[data-zone] #col-tower .tab-page { border-image: url(../assets/ui/v2/panel_ice_rb.png) 10 fill / 10px stretch !important; }
body[data-zone="desert"] #col-tower .tab-page { border-image: url(../assets/ui/v2/panel_desert_rb.png) 10 fill / 10px stretch !important; }
body[data-zone] #col-tower .tabs .tab { border-image: url(../assets/ui/v2/tab_off_ice_r.png) 10 fill / 10px 10px 0 10px stretch !important; }
body[data-zone] #col-tower .tabs .tab.on { border-image: url(../assets/ui/v2/panel_ice_r.png) 10 fill / 10px 10px 0 10px stretch !important; }
body[data-zone="desert"] #col-tower .tabs .tab { border-image-source: url(../assets/ui/v2/tab_off_desert_r.png) !important; }
body[data-zone="desert"] #col-tower .tabs .tab.on { border-image-source: url(../assets/ui/v2/panel_desert_r.png) !important; }

/* แท็บมีแค่ 2 อัน ไม่ต้องยืดเต็มแถว */
body[data-zone] #col-tower .tabs .tab { flex: 0 0 110px !important; }
/* ฉากต้องตรงแนวกับฉาก The Trail / Village (จ๊อบ 5 ต.ค.: เดิมสูงกว่า 9 px) และกรอบยาวลงถึงล่างเท่าคอลัมน์อื่น */
body[data-zone] main > section#col-tower:not(.m-off) { display: flex !important; flex-direction: column; }   /* 7 ต.ค.: :not(.m-off) — เดิมชนะกฎซ่อนแผงของมือถือ หอคอยเลยโผล่ทุกหน้าบนมือถือ (จ๊อบเจอที่หน้า Villagers) */
body[data-zone] #col-tower .tab-page { padding: 17px 8px 10px !important; flex: 1 1 auto; min-height: 0; }
body[data-zone] #col-tower .tab-page.hidden { display: none !important; }

/* ---- ฉาก Arena (แท่นหิน · arena_art/arena_C1.jpg ย่อเป็น 320) · ขนาด/ป้าย/โซ่เหมือนหอคอย ---- */
#arena-scene { width: 322px; height: 322px; max-width: none; aspect-ratio: auto; margin-left: auto; margin-right: auto; flex: none;
  position: relative; overflow: hidden; border: 1px solid var(--frame-dark, #080a12);
  background: #0b0e14 url(../assets/scenes_arena/arena.png) 0 0 / 320px 320px no-repeat; image-rendering: pixelated; }
#ar-stage { position: absolute; inset: 0; }
/* ฆ้องท้าประลอง (5 ต.ค. แทนป้ายแบบหอคอย) ภาพ tools/import_gong.py · จุด = กึ่งกลางฐาน */
button.ar-gong { position: absolute; transform: translate(-50%, -100%); padding: 0; border: 0; background: none !important; box-shadow: none !important;
  cursor: pointer; line-height: 0; clip-path: none; }
button.ar-gong img { display: block; width: 41px; height: 64px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
button.ar-gong:hover img { filter: brightness(1.15) drop-shadow(0 0 6px rgba(255,200,90,.75)); }
button.ar-gong.off { cursor: default; }
button.ar-gong.off img { filter: grayscale(.35) brightness(.85); }
button.ar-gong.hit img { animation: ar-gong-hit .5s ease-out; transform-origin: 50% 100%; }
@keyframes ar-gong-hit { 0% { transform: rotate(0); } 20% { transform: rotate(-4deg) translateX(-1px); } 45% { transform: rotate(3deg) translateX(1px); }
                         70% { transform: rotate(-1.5deg); } 100% { transform: rotate(0); } }
/* วงคลื่นเสียงออกจากกลางหน้าฆ้อง (สูงจากฐาน ~36px) */
.ar-wave { position: absolute; width: 18px; height: 18px; margin: -45px 0 0 -9px; border: 2px solid rgba(255,220,130,.9); border-radius: 50%;
  pointer-events: none; z-index: 900; opacity: 0; animation: ar-wave .9s ease-out forwards; }
@keyframes ar-wave { 0% { opacity: .95; transform: scale(.4); } 100% { opacity: 0; transform: scale(3.4); } }
@media (prefers-reduced-motion: reduce) { button.ar-gong.hit img, .ar-wave { animation: none; } }

#arena-scene .tw-anchor { position: absolute; top: 0; width: 24px; height: 28px; image-rendering: pixelated; z-index: 4; pointer-events: none; }
#arena-scene .tw-anchor.l { left: 84px; } #arena-scene .tw-anchor.r { left: 212px; }
#arena-scene .tw-chain { top: 21px !important; height: 113px !important; background-position: 0 -14px !important; z-index: 5 !important; }
#arena-scene:hover .tw-chain, #arena-scene:hover button.tw-sign { animation-duration: 2.2s; }

/* ---- แผงล่าง Arena ---- */
.ar-team .tw-m.empty { cursor: pointer; }
.ar-save-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.ar-save-row .muted { font-size: 11px; }
.ar-board { margin: 0; padding: 0; list-style: none; }
.ar-board li { display: flex; gap: 6px; align-items: center; padding: 2px 4px; font-size: 11px; }
.ar-board li b { width: 22px; text-align: right; color: var(--muted); font-weight: normal; }
.ar-board li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-board li i { font-style: normal; color: var(--ice); }
.ar-board li.me { background: rgba(159,216,224,.12); }
.ar-board .muted { padding: 4px; font-size: 11px; }

/* หน้าต่างเลือกคู่ */
.ar-foes { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; text-align: left; }
.ar-foe { display: flex; align-items: center; gap: 8px; padding: 6px; background: rgba(0,0,0,.25); border: 2px solid var(--frame-dark, #06101c); }
.ar-foe .nm { flex: 1; min-width: 0; }
.ar-foe .nm b { display: block; font: 13px var(--pix, monospace); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-foe .nm span { font-size: 11px; color: var(--muted); }
.ar-foe .bot { display: inline-block; margin-left: 6px; padding: 1px 4px; vertical-align: 1px; font: 10px/1.2 var(--pix, monospace) !important;
  color: #0b1d2a !important; background: #9fb4c8; text-shadow: none !important; letter-spacing: 1px; }
body[data-zone] .ar-foe .c-btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.ar-foe .mini { display: flex; gap: 2px; }
.ar-foe .mini img { width: 22px; height: 26px; image-rendering: pixelated; object-fit: contain; }
.ar-foe .c-btn { flex: none; width: 64px; }

/* ---- การสู้ใน Arena (ขั้น 2) ---- */
.ar-vs span { font-size: 30px; }
.ar-result { position: absolute; left: 0; right: 0; top: 30%; z-index: 1000; text-align: center; pointer-events: none; animation: ar-pop .35s ease-out; }
.ar-result b { display: block; font: 26px/1.1 var(--pix, monospace); letter-spacing: 4px; text-shadow: 2px 2px 0 #0a0c10, 0 0 8px rgba(0,0,0,.8); }
.ar-result.win b { color: #ffd060; }
.ar-result.lose b { color: #ff6a5a; }
.ar-result span { display: inline-block; margin-top: 4px; padding: 2px 8px; font: 12px var(--pix, monospace); color: #eef7fd; background: rgba(8,10,16,.75); }
@keyframes ar-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ar-vsrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ar-side .tw-h { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-hp { margin: 2px 0; font-size: 10px; }
.ar-hp span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ar-hp i { display: block; height: 4px; background: #06101c; border: 1px solid #2c5070; }
.ar-hp i b { display: block; height: 100%; background: #7fc45a; }
.ar-hp.down span { color: var(--muted); text-decoration: line-through; }
.ar-bot { padding: 0 3px; font: 9px var(--pix, monospace); color: #0b1d2a; background: #9fb4c8; letter-spacing: 1px; }

/* 18 ต.ค. จ๊อบ: แท็บแรก (Tower) ชิดซ้ายสุดของกรอบ ไม่ให้เห็นมุมเล็กๆ โผล่ทางซ้าย (แบบเดียวกับคอลัมน์ขวา ใน pets.css) */
body[data-zone] #col-tower .tabs#tw-tabs { padding-left: 0 !important; }
body[data-zone] #col-tower .tabs#tw-tabs .tab:first-child.on::before { display: none; }
body[data-zone] #col-tower .tabs#tw-tabs .tab:first-child.on { z-index: 2; }

/* ---- ห้องซ้อม (3 พ.ย. 2026 จ๊อบ · training.js) · ฉาก Gemini tools/training/ ย่อ 320 · ขนาดเท่าหอคอย/อารีน่า ---- */
#train-scene { width: 322px; height: 322px; max-width: none; aspect-ratio: auto; margin-left: auto; margin-right: auto; flex: none;
  position: relative; overflow: hidden; border: 1px solid var(--frame-dark, #080a12);
  background: #0b0e14 url(../assets/scenes_tower/training_hall.png) 0 0 / 320px 320px no-repeat; image-rendering: pixelated; }
#tr-stage { position: absolute; inset: 0; }
body[data-zone] #train-scene { border-radius: 10px !important; }
body.m-mode #train-scene { zoom: .94; }
body[data-zone] .tr-modes .job.on { filter: brightness(1.25); box-shadow: inset 0 0 0 2px #ffd76a; }
body[data-zone] .tr-res .tw-h { display: flex; justify-content: space-between; align-items: baseline; }
body[data-zone] .tr-res .tw-h .muted { font-size: 10px; }
body[data-zone] .tr-table { width: 100%; border-collapse: collapse; font: 11px var(--pix); }
body[data-zone] .tr-table th { color: var(--muted, #9fbad2); font-weight: normal; text-align: right; padding: 2px 4px; }
body[data-zone] .tr-table td { text-align: right; padding: 3px 4px; border-top: 1px solid rgba(255,255,255,.07); white-space: nowrap; }
body[data-zone] .tr-table td:first-child { text-align: left; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
body[data-zone] .tr-table tr.sum td { color: #ffd76a; border-top: 1px solid rgba(255,215,106,.35); }
body[data-zone] .tr-go { min-width: 0 !important; height: auto !important; font-size: 13px !important; }
