:root {
  --ol: #26170f; --gold: #f2b84b; --gold2: #ffd98a; --hp1: #ff6b5a; --hp2: #c2352b; --sp1: #6cc0ff; --sp2: #2f6fc0;
  --panel: rgba(30, 22, 17, .84); --panel-b: #7a5a3a; --text: #fff3df; --muted: #cdb89a; --good: #7fe08a; --bad: #ff7b6b;
  --font: system-ui, -apple-system, "Sukhumvit Set", "Thonburi", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d0a08; color: var(--text); font-family: var(--font); font-size: 14px; overflow: hidden;
  -webkit-text-size-adjust: 100%; -webkit-user-select: none; user-select: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#shell { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { position: relative; flex: none; overflow: hidden; transform-origin: center; background: #121626; }
#shell.framed #stage { box-shadow: 0 0 0 2px #3b2b1d, 0 10px 40px #000a; border-radius: 10px; }
#cv { position: absolute; left: 0; top: 0; display: block; }
#loading { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; font-size: 16px; color: var(--muted); background: #0d0a08; }
body.ready #loading { display: none; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { position: absolute; pointer-events: auto; }
.pnl { background: var(--panel); border: 2px solid var(--panel-b); border-radius: 12px; box-shadow: inset 0 1px 0 rgba(255, 220, 170, .18), 0 3px 0 rgba(0, 0, 0, .35); }
.hidden { display: none !important; }
.out { text-shadow: 0 1px 0 #000, 0 0 3px #000; }

#me { left: 12px; top: 10px; display: flex; gap: 8px; align-items: center; padding: 6px 10px 6px 6px; width: 236px; pointer-events: none; }
#me .av { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; background: #3b5b66; border: 3px solid var(--gold); overflow: hidden; }
#me .av img { position: absolute; width: 110px; left: -32px; top: -4px; }
#me .lvb { position: absolute; left: 0; bottom: 0; background: linear-gradient(#ffd98a, #f2b84b); color: #3a2208; font-weight: 800; font-size: 12px; border-radius: 8px; padding: 0 5px; border: 1.5px solid var(--ol); }
#me .bars { flex: 1; display: grid; gap: 3px; }
#me .nm { font-weight: 800; font-size: 14px; color: var(--text); text-shadow: 0 1px 0 #000; }
.bar { position: relative; height: 14px; border-radius: 7px; background: #2a1a12; border: 1.5px solid var(--ol); overflow: hidden; }
.bar b, .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 1) * 100%); }
.bar b { background: #fff1d0; opacity: .85; }
.bar.hp i, .bar.thp i { background: linear-gradient(var(--hp1), var(--hp2)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
.bar.sp i { background: linear-gradient(var(--sp1), var(--sp2)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
.bar.sp b { opacity: 0; }
.bar span { position: absolute; inset: 0; font-size: 12px; line-height: 12px; font-weight: 800; text-align: center; color: #fff; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
#me.low .bar.hp { animation: lowhp .6s infinite alternate; }
@keyframes lowhp { to { box-shadow: 0 0 8px #ff3b30; } }

#buffs { left: 12px; top: 76px; display: flex; gap: 6px; pointer-events: none; }
.buff { position: relative; width: 40px; height: 40px; border-radius: 10px; border: 2px solid #ffb347; background: #3a2412; overflow: hidden; box-shadow: 0 0 8px rgba(255, 160, 60, .6); }
.buff img { width: 100%; height: 100%; }
.buff::after { content: ""; position: absolute; inset: 0; background: conic-gradient(transparent calc(var(--p) * 1turn), rgba(10, 6, 4, .6) 0); }
.buff span { position: absolute; right: 2px; bottom: 0; font-size: 12px; font-weight: 900; color: #fff; z-index: 1; text-shadow: 0 1px 0 #000, 0 0 3px #000; }

#target { left: 50%; top: 10px; transform: translateX(-50%); width: 280px; padding: 5px 10px 7px; pointer-events: none; }
#target .tn { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; margin-bottom: 3px; }
#target .chip { font-size: 12px; font-weight: 700; padding: 0 7px; border-radius: 8px; border: 1.5px solid var(--c, #9fe0a0); color: var(--c, #9fe0a0); }
#target.boss { border-color: #c2552b; }
#target.boss .nm { color: #ffb38a; }

#mini { right: 12px; top: 10px; padding: 4px; width: 168px; pointer-events: none; }
#mini canvas { display: block; width: 156px; height: 104px; border-radius: 8px; }
#mini .mapname { font-size: 12px; color: var(--muted); text-align: center; padding-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#menuBtn { right: 188px; top: 10px; width: 44px; height: 44px; border-radius: 12px; background: var(--panel); border: 2px solid var(--panel-b); display: flex; align-items: center; justify-content: center; color: var(--gold2); }
#tally { right: 6px; top: 138px; min-width: 44px; min-height: 44px; padding: 0 6px; margin: 0; background: none; border: 0; display: flex; align-items: center; justify-content: flex-end; pointer-events: auto; cursor: pointer; font: inherit; }
#tally .tv { padding: 4px 10px; font-size: 13px; font-weight: 700; color: var(--gold2); white-space: nowrap; }
#tallyTip { right: 12px; top: 184px; z-index: 5; max-width: 260px; padding: 6px 10px; font-size: 13px; line-height: 1.35; color: #fff3df; pointer-events: auto; }
#lootFeed { right: 12px; top: 182px; display: grid; gap: 4px; justify-items: end; pointer-events: none; }
#lootFeed .li { display: flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; border-radius: 10px; background: rgba(30, 22, 17, .78); border: 1.5px solid #5a4330; font-size: 13px; animation: lin .25s ease-out; transition: opacity .4s, transform .4s; }
#lootFeed .li img { height: 22px; }
#lootFeed .li b { color: var(--gold2); }
#lootFeed .li.stone { border-color: #8a6bd0; }
#lootFeed .li.out { opacity: 0; transform: translateX(20px); }
#lootFeed .li.bump b { animation: bump .25s; }
#lootFeed .coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #ffcf4a 45%, #c48a1c); border: 1.5px solid #3a2208; }
@keyframes lin { from { opacity: 0; transform: translateX(24px); } }
@keyframes bump { 50% { transform: scale(1.4); } }

/* skill buttons */
.sk { position: absolute; width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 3px solid var(--ring, var(--gold)); background: #2a1a12; overflow: hidden;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(0, 0, 0, .45); touch-action: none; }
.sk img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); border-radius: 50%; pointer-events: none; }
.sk .cdw { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(12, 8, 6, .72) calc(var(--p, 0) * 1turn), transparent 0); pointer-events: none; }
.sk .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900; color: #fff; text-shadow: 0 1px 0 #000, 0 0 4px #000; pointer-events: none; }
.sk .key { position: absolute; left: 50%; top: 1px; transform: translateX(-50%); font-size: 12px; font-weight: 900; color: #fff3df; text-shadow: 0 1px 0 #000, 0 0 3px #000; pointer-events: none; }
.sk .spc { position: absolute; right: 6px; bottom: 2px; font-size: 12px; font-weight: 900; color: #a6d8ff; text-shadow: 0 1px 0 #000, 0 0 3px #000; pointer-events: none; }
.sk.nosp .spc { color: #ff6b5a; }
.sk.nosp img { filter: grayscale(.6) brightness(.7); }
.sk.fire { animation: fire .25s ease-out; }
.sk.flashr::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; box-shadow: 0 0 0 3px #fff inset; animation: flr .4s ease-out forwards; z-index: 2; }
.sk.aiming { box-shadow: 0 0 0 3px #ffd98a, 0 0 14px #ffb347; }
@keyframes fire { 40% { transform: scale(.9); } }
@keyframes flr { from { opacity: 1; } to { opacity: 0; transform: scale(1.25); } }

#atkBtn { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--gold); background: radial-gradient(circle at 40% 35%, #6a4228, #2a1a12 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; box-shadow: 0 4px 0 rgba(0, 0, 0, .45); touch-action: none; }
#atkBtn .lbl { font-size: 12px; font-weight: 800; color: var(--gold2); }
#atkBtn:active { transform: scale(.94); }
#autoBtn { width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--panel-b); background: var(--panel); color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; touch-action: none; }
#autoBtn .lbl { font-size: 12px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
#autoBtn.on { border-color: #7fe08a; color: #b9ffc0; box-shadow: 0 0 12px rgba(127, 224, 138, .55); }
#autoBtn.on svg { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#joyZone { left: 0; bottom: 0; width: 40%; height: 62%; touch-action: none; }
#joyBase { position: absolute; left: 96px; top: calc(100% - 96px); width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  border: 2px solid rgba(255, 243, 223, .35); background: rgba(30, 22, 17, .22); opacity: .3; pointer-events: none; }
#joyBase.on { opacity: 1; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff3df, #cdb89a); border: 2px solid var(--ol); }

#castbar { left: 50%; bottom: 120px; transform: translateX(-50%); width: 220px; height: 22px; border-radius: 11px; background: rgba(30, 22, 17, .86); border: 2px solid var(--panel-b); overflow: hidden; pointer-events: none; }
#castbar i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); background: linear-gradient(#ffd98a, #f2b84b); }
#castbar span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
#toast { left: 50%; top: 36%; transform: translateX(-50%); font-size: 15px; font-weight: 800; color: #fff3df; text-shadow: 0 1px 0 #000, 0 0 4px #000; opacity: 0; pointer-events: none; white-space: nowrap; }
#toast.show { animation: toast 1.1s ease-out; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 8px); } 15% { opacity: 1; transform: translate(-50%, 0); } 75% { opacity: 1; } 100% { opacity: 0; } }
#help { left: 12px; bottom: 10px; font-size: 12px; color: var(--muted); text-shadow: 0 1px 0 #000; pointer-events: none; max-width: 40%; }
#srcTag { display: none; }

/* settings */
#settings { right: 12px; top: 64px; width: 300px; max-height: calc(100% - 76px); overflow-y: auto; padding: 8px 12px 12px; z-index: 5; font-size: 14px; touch-action: pan-y; }
#settings .sh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
#settings .sh b { font-size: 15px; color: var(--gold2); }
#settings .close { min-height: 44px; min-width: 64px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; }
#settings .fps { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
#settings .fps b { color: var(--good); font-size: 15px; }
#settings .fps small { display: block; font-size: 12px; }
#settings .row { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
#settings .row input { width: 22px; height: 22px; accent-color: #f2b84b; }
#settings .grp { margin-top: 6px; font-size: 13px; color: var(--muted); }
#settings .seg { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#settings .seg button, #settings .btns button { min-height: 44px; min-width: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; font-size: 13px; color: var(--text); }
#settings .seg button[aria-pressed=true] { border-color: var(--gold); background: #3a2814; color: var(--gold2); }
#settings .btns { display: flex; gap: 6px; flex-wrap: wrap; }
#settings .btns button { flex: 1; }

/* ---------- PC layout ---------- */
#stage.pc #atkBtn, #stage.pc #joyZone { display: none; }
#stage.pc #skillbar { left: 50%; bottom: 14px; transform: translateX(-50%); width: 340px; height: 68px; pointer-events: none; }
#stage.pc #skillbar .sk { top: 0; pointer-events: auto; }
#stage.pc #skillbar .sk:nth-child(1) { left: 0; }
#stage.pc #skillbar .sk:nth-child(2) { left: 68px; }
#stage.pc #skillbar .sk:nth-child(3) { left: 136px; }
#stage.pc #skillbar .sk:nth-child(4) { left: 204px; }
#stage.pc #autoBtn { left: calc(50% + 116px); bottom: 16px; }
#stage.pc #castbar { bottom: 100px; }

/* ---------- mobile layout (landscape) ---------- */
#stage.mob #help { display: none; }
#stage.mob #me { width: 196px; padding: 4px 8px 4px 4px; gap: 6px; }
#stage.mob #me .av { width: 38px; height: 38px; }
#stage.mob #me .av img { width: 92px; left: -27px; top: -3px; }
#stage.mob #me .nm { font-size: 13px; }
#stage.mob .bar { height: 13px; }
#stage.mob #buffs { top: 62px; }
#stage.mob #buffs .buff { width: 36px; height: 36px; }
#stage.mob #target { width: 220px; top: 8px; padding: 3px 8px 5px; }
#stage.mob #target .tn { font-size: 13px; margin-bottom: 2px; }
#stage.mob #mini { width: 104px; padding: 3px; }
#stage.mob #mini canvas { width: 96px; height: 64px; }
#stage.mob #mini .mapname { display: none; }
#stage.mob #menuBtn { right: 124px; top: 10px; }
#stage.mob #tally { top: 72px; }
#stage.mob #tally .tv { font-size: 12px; padding: 2px 8px; }
#stage.mob #tallyTip { top: 116px; right: 74px; font-size: 12px; max-width: 230px; }
#stage.mob #lootFeed { left: 12px; right: auto; top: 104px; justify-items: start; }
#stage.mob #lootFeed .li { font-size: 12px; }
#stage.mob #lootFeed .li img { height: 18px; }
/* combat buttons hug the bottom-right corner in an L: attack 72, skills 50 (two left, two above), auto 46 in the inner corner.
   (doc sizes were 84 / 60; reduced to keep the play area clear at 667x320, all still >= 44) */
#stage.mob #atkBtn { right: 12px; bottom: 12px; width: 72px; height: 72px; }
#stage.mob #atkBtn svg { width: 28px; height: 28px; }
#stage.mob #skillbar { position: absolute; right: 48px; bottom: 48px; width: 0; height: 0; pointer-events: none; }
#stage.mob #skillbar .sk { pointer-events: auto; width: 50px; height: 50px; margin: -25px 0 0 -25px; }
#stage.mob #skillbar .sk .cdt { font-size: 16px; }
#stage.mob #skillbar .sk:nth-child(1) { left: -67px; top: 3px; }
#stage.mob #skillbar .sk:nth-child(2) { left: -123px; top: 6px; }
#stage.mob #skillbar .sk:nth-child(3) { left: 3px; top: -67px; }
#stage.mob #skillbar .sk:nth-child(4) { left: 6px; top: -123px; }
#stage.mob #autoBtn { right: 85px; bottom: 85px; width: 46px; height: 46px; border-radius: 50%; }
#stage.mob #autoBtn .lbl { display: none; }
/* buttons fade back when the player has not touched them for a while */
#stage.mob #skillbar .sk, #stage.mob #atkBtn, #stage.mob #autoBtn { transition: opacity .3s; }
#stage.mob.idle #skillbar .sk, #stage.mob.idle #atkBtn, #stage.mob.idle #autoBtn:not(.on) { opacity: .62; }
#stage.mob.idle #autoBtn.on { opacity: .8; }
#stage.mob #castbar { bottom: auto; top: 58%; }
#stage.mob #settings { top: 60px; max-height: calc(100% - 70px); }
#stage.mob.short #me { width: 188px; }

/* portrait phone: ask to rotate */
#rotate { display: none; position: fixed; inset: 0; z-index: 50; background: #0d0a08; color: var(--text); flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; }
#rotate b { font-size: 18px; }
#rotate span { font-size: 14px; color: var(--muted); }
#rotate .phone { width: 46px; height: 78px; border: 4px solid var(--gold); border-radius: 10px; animation: rot 1.8s ease-in-out infinite; }
@keyframes rot { 40%, 70% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

/* ---------- round 8 ---------- */
#loading .logo { font-size: 28px; letter-spacing: 1px; color: var(--gold2); }
#target { pointer-events: auto; cursor: pointer; }
#target .ax { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
#target .ax img { display: block; }
#target .ax .race { margin: 0 2px; }
#target .up { color: #ffd24a; font-size: 13px; }
#target .dn { color: #b9b3cc; font-size: 13px; }
#target .axd { margin-top: 4px; display: grid; gap: 2px; font-size: 12px; }
#target .axd div { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; }
#target .axd .sum { border-top: 1px solid #5a4330; padding-top: 2px; font-weight: 800; }
#stage.mob #target .ax .race { display: none; }
#settings details { border-top: 1px solid #3b2b1d; margin-top: 6px; }
#settings summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; color: var(--gold2); cursor: pointer; list-style: none; }
#settings summary::before { content: '▸'; margin-right: 6px; }
#settings details[open] > summary::before { content: '▾'; }
#settings .vol { display: grid; grid-template-columns: 84px 1fr 44px; align-items: center; gap: 6px; min-height: 44px; font-size: 13px; }
#settings .vol input { width: 100%; accent-color: #f2b84b; height: 28px; }
#settings .vol b { font-size: 12px; color: var(--muted); text-align: right; }
#settings .sndrow { display: grid; grid-template-columns: 1fr auto 44px; align-items: center; gap: 4px; font-size: 12px; margin-top: 4px; }
#settings .sndrow .seg { margin-top: 0; }
#settings .play { min-height: 44px; min-width: 44px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; color: var(--gold2); }
#settings .note { display: block; font-size: 12px; color: var(--muted); }
#target .tn .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#target .tn { min-width: 0; }

/* ---------- round 9: logo, start screen ---------- */
.logo-img { width: min(360px, 62vw); max-height: 42vh; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
#rotate .logo-img { width: min(260px, 70vw); }
#start { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(circle at 50% 40%, rgba(60,40,24,.82), rgba(10,8,6,.94)); text-align: center; padding: 16px; }
#start.hidden { display: none; }
#start span { font-size: 14px; color: var(--muted); }
#startBtn { min-height: 48px; min-width: 180px; padding: 8px 22px; border-radius: 14px; border: 2px solid var(--gold); background: linear-gradient(#6a4228, #3a2412); color: var(--gold2); font-size: 17px; font-weight: 800; }
#startLang { min-height: 44px; min-width: 96px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; color: var(--text); font-size: 13px; }
@media (max-height: 360px) { #start .logo-img { max-height: 46vh; } #start { gap: 6px; } }
/* ---------- round 10 ---------- */
#settings .row.kind { display: grid; grid-template-columns: 22px auto 1fr auto; gap: 8px; align-items: center; min-height: 44px; }
#settings .row.kind .ic { display: inline-flex; gap: 2px; }
#settings .row.kind .kn { font-size: 13px; line-height: 1.2; }
#settings .row.kind .kn small { display: block; font-size: 12px; color: var(--muted); }
#settings .row.kind .up { color: #ffd24a; font-size: 13px; }
#settings .row.kind .dn { color: #b9b3cc; font-size: 13px; }
#settings .row.kind .eq { color: var(--muted); }
#expBanner { left: 50%; top: 56px; transform: translateX(-50%); padding: 3px 10px; border-radius: 8px; background: rgba(120, 40, 120, .82); border: 1.5px solid #d8a6ff; font-size: 12px; font-weight: 800; color: #fff; pointer-events: none; white-space: nowrap; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
#stage.mob #expBanner { top: 52px; }

/* round 11: skills locked with bare hands */
.sk.locked img { filter: grayscale(1) brightness(.55); }
.sk.locked::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: repeating-linear-gradient(45deg, rgba(0,0,0,.35) 0 4px, transparent 4px 8px); pointer-events: none; }
.sk.locked { border-color: #6b6470 !important; }

/* ---------- round 13: boss contribution ---------- */
.bchip { display: flex; align-items: center; gap: 3px; height: 26px; padding: 0 7px 0 4px; border-radius: 13px; background: rgba(30,22,17,.8); border: 1.5px solid #c9a24a; font-size: 12px; color: #ffe08a; align-self: center; }
.bchip b { font-size: 12px; }
#bossSum { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(8,6,4,.55); pointer-events: auto; }
#bossSum.hidden { display: none; }
#bossSum .bs { width: min(680px, calc(100% - 24px)); max-height: calc(100% - 16px); overflow-y: auto; padding: 8px 12px 10px; font-size: 13px; touch-action: pan-y; }
#bossSum .bh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#bossSum .bh b { font-size: 15px; color: var(--gold2); }
#bossSum .close { min-height: 44px; min-width: 64px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; }
#bossSum .test { font-size: 12px; color: #e8c6ff; background: rgba(120,40,120,.5); border-radius: 6px; padding: 1px 8px; display: inline-block; margin: 2px 0 4px; }
#bossSum .res { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin: 2px 0 4px; font-size: 13px; }
#bossSum .res span { display: inline-flex; align-items: center; gap: 4px; }
#bossSum .ok { color: #9ff0a6; font-weight: 800; } #bossSum .no { color: #c7c0d8; }
#bossSum .bi { vertical-align: middle; }
#bossSum .pts { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
#bossSum .pp { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; padding: 1px 6px; border-radius: 8px; background: #22180f; border: 1px solid #5a4330; }
#bossSum .pp.me { border-color: var(--gold); color: var(--gold2); } #bossSum .pp.out { opacity: .6; }
#bossSum .pp i, #bossSum td.pt i, #bossSum .who i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; border: 1px solid #26170f; margin-right: 2px; }
#bossSum .loot { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; margin-bottom: 4px; }
#bossSum .loot .li { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 3px 4px; border-radius: 8px; background: #1c140e; border: 1px solid #3b2b1d; min-width: 74px; }
#bossSum .loot .li.me { border-color: var(--gold); background: #3a2814; }
#bossSum .loot .mini { width: 70px; height: 14px; }
#bossSum .loot .who { font-size: 12px; font-weight: 800; }
#bossSum table { width: 100%; border-collapse: collapse; font-size: 12px; }
#bossSum th, #bossSum td { padding: 2px 4px; text-align: right; white-space: nowrap; }
#bossSum td.nm, #bossSum th:nth-child(2) { text-align: left; } #bossSum td.pt { text-align: left; }
#bossSum tr.me td { color: var(--gold2); font-weight: 800; } #bossSum tr.win td { background: rgba(201,166,255,.25); }
#bossSum .tw { max-height: 46vh; overflow-y: auto; }
#bossSum .note { font-size: 12px; color: var(--muted); margin-top: 4px; }
#bossSum canvas.roll { display: block; margin: 4px auto; }
#bossSum canvas.roll.hidden { display: none; }
#bossSum .won { text-align: center; font-size: 15px; color: #e8c6ff; display: flex; justify-content: center; align-items: center; gap: 6px; margin-bottom: 4px; }
#stage.short #bossSum .tw { max-height: none; }
/* ---------- round 13: auto skills, option D ---------- */
.asbar { display: flex; gap: 6px; margin: 4px 0; }
.asi { position: relative; width: 48px; height: 48px; padding: 0; border-radius: 12px; border: 2px solid #5a4330; background: #22180f; opacity: .5; }
.asi img { width: 100%; height: 100%; border-radius: 10px; filter: grayscale(.8); }
.asi.on { opacity: 1; border-color: #7fe08a; } .asi.on img { filter: none; }
.asi b { position: absolute; left: 3px; top: 0; font-size: 12px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.asi i { position: absolute; right: 1px; bottom: 1px; font-size: 12px; font-style: normal; font-weight: 900; background: #2f8a3a; color: #fff; border-radius: 4px; padding: 0 3px; display: none; }
.asi.on i { display: block; }
.aslink { min-height: 44px; padding: 4px 12px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; color: var(--gold2); font-size: 13px; margin-bottom: 4px; }
#skillPage { position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; background: rgba(8,6,4,.5); pointer-events: auto; }
#skillPage.hidden { display: none; }
#skillPage .sp { width: min(640px, calc(100% - 20px)); max-height: calc(100% - 12px); overflow-y: auto; padding: 6px 10px 8px; }
#skillPage .sh { display: flex; justify-content: space-between; align-items: center; }
#skillPage .sh b { color: var(--gold2); font-size: 15px; }
#skillPage .close { min-height: 44px; min-width: 64px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; }
#skillPage .tabs { display: flex; gap: 4px; margin: 2px 0 4px; }
#skillPage .tabs button { min-height: 44px; min-width: 72px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; font-size: 13px; }
#skillPage .tabs button.act { border-color: var(--gold); background: #3a2814; color: var(--gold2); }
#skillPage .hint { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
#skillPage .asr { display: flex; align-items: center; gap: 6px; min-height: 46px; border-bottom: 1px solid #3b2b1d; white-space: nowrap; }
#skillPage .asr.off { opacity: .55; }
#skillPage .asr .no { width: 16px; text-align: center; font-weight: 900; color: var(--gold2); font-size: 13px; }
#skillPage .asr img { width: 34px; height: 34px; border-radius: 8px; }
#skillPage .asr .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
#skillPage .asr .src { font-size: 12px; color: var(--muted); }
#skillPage .cond { min-height: 44px; min-width: 64px; border-radius: 10px; border: 1px dashed #c9a24a; background: #2a1e12; color: #ffe08a; font-size: 13px; font-weight: 800; }
#skillPage .tog { min-height: 44px; min-width: 52px; border-radius: 22px; border: 1px solid #5a4330; background: #3a2a2a; font-size: 13px; }
#skillPage .tog.on { background: #2f8a3a; border-color: #7fe08a; color: #fff; }
#skillPage .mv { min-height: 44px; min-width: 44px; border-radius: 10px; border: 1px solid #5a4330; background: #22180f; color: var(--gold2); }
#skillPage .mv:disabled { opacity: .3; }
#bossSum small { font-size: 12px; }
#bossSum .pers { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 3px 8px; margin: 0 0 4px; border-radius: 8px; background: #1c140e; border: 1px solid #3b2b1d; font-size: 13px; }
#bossSum .pers.ok { border-color: #5f9a5a; } #bossSum .pers .sep { color: #5a4330; }
#bossSum .pers b { display: inline-flex; align-items: center; gap: 3px; color: var(--gold2); }

/* round 17: status icons (hero buff row, target frame), silenced skills, cast bar hit / break */
.buff.st { border-color: var(--c); box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent); background: #2a1d14; }
.buff.st i { position: absolute; left: 2px; top: 0; font-size: 12px; font-weight: 900; font-style: normal; color: #fff; z-index: 1; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
#target .tst { display: flex; gap: 4px; margin-top: 4px; }
#target .tst:empty { display: none; }
.buff.sm { width: 30px; height: 30px; border-radius: 8px; border-width: 1.5px; }
.sk.silenced img { filter: grayscale(.8) brightness(.6); }
.sk.silenced::before { content: ''; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; transform: translate(-50%, -50%); background: var(--sil) center / contain no-repeat; z-index: 2; pointer-events: none; }
#castbar.shake { animation: castShake .12s linear infinite; border-color: #ff6a5a; }
#castbar.broken { border-color: #ff4a3a; }
#castbar.broken i { background: linear-gradient(#ff7a6a, #c8322a); width: 100%; }
@keyframes castShake { 0%, 100% { margin-left: 0; } 25% { margin-left: -3px; } 75% { margin-left: 3px; } }
.stbtns { display: flex; flex-wrap: wrap; gap: 4px; }
.stbtns button { min-width: 44px; min-height: 44px; padding: 0 8px; font: 700 13px var(--font, inherit); color: #fff3df; background: #3a2a1d; border: 1.5px solid #6a4c33; border-radius: 10px; }
#stage.mob #target .buff.sm { width: 26px; height: 26px; }
.sk.stunned img { filter: grayscale(.6) brightness(.55); }
/* round 19: one-roll cast rule - survived the roll: gold frame; later hits: light shake */
#castbar.safe { border-color: #ffcf3a; box-shadow: 0 0 8px rgba(255, 207, 58, .7); }
#castbar.soft { animation: castShakeSoft .12s linear infinite; }
@keyframes castShakeSoft { 0%, 100% { margin-left: 0; } 25% { margin-left: -1px; } 75% { margin-left: 1px; } }
#skillPage .asr .or { font-size: 12px; color: var(--muted); padding: 0 2px; }
#skillPage .cond.empty { opacity: .7; }
/* round 21: per-party boss table */
#bossSum tr.ph td { background: rgba(255, 220, 160, .08); font-weight: 800; border-top: 1px solid #5a4330; }
#bossSum tr.mb td.nm { padding-left: 14px; font-weight: 500; }
#bossSum tr.inel td { opacity: .45; }
#bossSum tr.ph .tag { font-size: 12px; padding: 0 6px; border-radius: 8px; margin-left: 4px; }
#bossSum tr.ph.in .tag { background: rgba(242, 184, 75, .25); color: var(--gold2); }
#bossSum tr.ph.out .tag { background: rgba(120, 110, 100, .3); color: var(--muted); }
#bossSum tr.ph.out td { opacity: .75; }
.bchip.out { filter: grayscale(.8); opacity: .8; }
.bchip small { font-size: 12px; margin-left: 3px; }
/* round 21: quick party button at boss start */
#pfBtn { left: 50%; top: 92px; transform: translateX(-50%); min-height: 44px; min-width: 44px; padding: 0 16px; font: 800 14px var(--font); color: var(--gold2); border-color: var(--gold); pointer-events: auto; animation: pfPulse 1.2s ease-in-out infinite; }
#stage.mob #pfBtn { top: 78px; font-size: 13px; }
@keyframes pfPulse { 0%, 100% { box-shadow: 0 0 0 rgba(242, 184, 75, 0); } 50% { box-shadow: 0 0 12px rgba(242, 184, 75, .8); } }
.bchip small.hp { margin-left: 6px; color: #8fe08a; }
