/* hud.css — in-night HUD. --u = 1% of the 16:9 frame height (set by Hud.layout) */
#hud { --u: 1vh; --gold: #ffcf7a; --plum: #1a0510; --mag: #ff2fa8; --cy: #2ff3ff;
  color: var(--gold); font-size: max(14px, calc(var(--u) * 3.6)); font-weight: 700; }
#hud .hp, #hud .ol { position: absolute; }
#hud .noptr, #hud .noptr * { pointer-events: none !important; }
#hud > .hp { pointer-events: none; }
#hud .tx { text-shadow: 1px 0 var(--plum), -1px 0 var(--plum), 0 1px var(--plum), 0 -1px var(--plum), 0 2px 3px rgba(0,0,0,.8); letter-spacing: .02em; }
.hudp { position: absolute; border: solid transparent; border-width: calc(var(--u) * 2.2); box-sizing: border-box;
  border-image: url(../assets/ui-panel.webp) 64 fill / calc(var(--u) * 2.2) stretch; background: none; }
#hud.hide .hp, #hud.hide .hp * { pointer-events: none !important; }
#hud .hp { transition: opacity .3s, transform .3s; }
#hud.hide .hp { opacity: 0 !important; }
#hud .hp > * { pointer-events: auto; }
#hud.shake { animation: hshake .3s; }
@keyframes hshake { 0%,100% { transform: none } 20% { transform: translate(-6px,3px) } 40% { transform: translate(5px,-3px) } 60% { transform: translate(-4px,-2px) } 80% { transform: translate(3px,2px) } }

/* heart */
.h-heart { left: 76px; top: 8px; display: flex; align-items: center; gap: calc(var(--u) * 1); padding: calc(var(--u) * .6) calc(var(--u) * 2) calc(var(--u) * .6) calc(var(--u) * 1);
  min-height: 44px; box-sizing: border-box; animation: pin .3s both; }
.h-heart svg { width: calc(var(--u) * 6); height: calc(var(--u) * 6); min-width: 24px; min-height: 24px; filter: drop-shadow(0 0 6px var(--mag)) drop-shadow(0 0 2px #fff4); }
.h-heart.pulse svg { animation: hbeat .5s; }
@keyframes hbeat { 0% { transform: scale(1) } 35% { transform: scale(1.4) } 100% { transform: scale(1) } }
.h-bar { position: relative; width: calc(var(--u) * 22); min-width: 90px; height: calc(var(--u) * 3.2); min-height: 14px; border-radius: 99px; background: #14040f; box-shadow: inset 0 0 0 1px #ff2fa855, 0 0 8px #ff2fa844; overflow: hidden; }
.h-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, #a8105f, #ff2fa8 70%, #ff9be0); box-shadow: 0 0 10px var(--mag); transition: width .5s cubic-bezier(.3,1.3,.5,1); }
.h-heart.pulse .h-fill { filter: brightness(1.5); }
.h-num { min-width: calc(var(--u) * 9); text-align: left; white-space: nowrap; font-size: max(16px, calc(var(--u) * 4)); }
@keyframes pin { from { opacity: 0; transform: translateY(-14px) scale(.9) } 60% { transform: translateY(2px) scale(1.03) } to { opacity: 1; transform: none } }

/* clock */
.h-clock { left: 50%; top: 6px; transform: translateX(-50%); width: calc(var(--u) * 22); min-width: 110px; height: calc(var(--u) * 8.4); min-height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; padding: 0; }
.h-clock .clk { font-size: max(18px, calc(var(--u) * 4.8)); line-height: 1; color: #ffe9b8; font-variant-numeric: tabular-nums; }
.h-clock .cbar { width: 78%; height: 3px; margin-top: 3px; background: #ffffff22; border-radius: 3px; overflow: hidden; }
.h-clock .cfill { height: 100%; width: 0; background: linear-gradient(90deg, var(--cy), var(--mag)); box-shadow: 0 0 6px var(--cy); }
.h-clock.danger { animation: cdanger .7s infinite; }
.h-clock.danger .clk { color: #ff4a5e; }
@keyframes cdanger { 0%,100% { filter: none } 50% { filter: drop-shadow(0 0 8px #f03) brightness(1.3) } }
.h-clock { transition: opacity .3s; }

/* gold */
.h-gold { right: 70px; top: 10px; display: flex; align-items: center; gap: calc(var(--u) * 1); height: 44px; padding: 0 calc(var(--u) * 2.2); box-sizing: border-box; border-radius: 12px;
  background: rgba(11,6,16,.78); box-shadow: inset 0 0 0 1px #e8b85a88, 0 0 8px #0008; animation: pin .3s .1s both; }
.h-gold img { width: calc(var(--u) * 5); height: calc(var(--u) * 5); min-width: 22px; min-height: 22px; object-fit: contain; }
.h-gold span { font-size: max(16px, calc(var(--u) * 4)); }

/* meters */
.h-meters { left: 10px; top: 22%; height: 44%; display: flex; gap: calc(var(--u) * 1.2); padding: calc(var(--u) * .8) calc(var(--u) * 1.2); box-sizing: border-box;
  background: rgba(11,6,16,.6); border-radius: 12px; box-shadow: inset 0 0 0 1px #e8b85a55; animation: pin .3s .05s both; }
.mt { display: flex; flex-direction: column; align-items: center; width: calc(var(--u) * 9.6); min-width: 40px; }
.mt .lb { font-size: max(12px, calc(var(--u) * 2.6)); height: calc(var(--u) * 3.6); line-height: calc(var(--u) * 3.6); white-space: nowrap; color: var(--c); }
.mt .tube { position: relative; flex: 1; width: 62%; margin: 2px 0; border-radius: 99px 99px 10px 10px; background: linear-gradient(90deg, #0a0610, #261630 40%, #0a0610); box-shadow: inset 0 0 0 1px #ffffff33, inset 0 0 8px #000; }
.mt .fill { position: absolute; left: 3px; right: 3px; bottom: 3px; height: 0; border-radius: 99px 99px 6px 6px; background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); box-shadow: 0 0 8px var(--c); transition: height .45s cubic-bezier(.3,1.2,.5,1); max-height: calc(100% - 6px); }
.mt .over { position: absolute; left: 3px; right: 3px; bottom: 0; height: 0; background: rgba(255,20,40,.55); mix-blend-mode: screen; transition: height .45s, bottom .45s; }
.mt .band { position: absolute; left: -4px; right: -4px; bottom: 0; height: 0; border: 2px solid var(--gold); border-radius: 5px; background: rgba(255,207,122,.12); box-sizing: border-box; transition: all .35s; }
.mt.in .band { background: rgba(255,230,160,.35); box-shadow: 0 0 12px 2px var(--gold), inset 0 0 8px #fff8; animation: bglow 1s infinite; }
.mt.in .tube { box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 8px #000; }
@keyframes bglow { 50% { box-shadow: 0 0 18px 4px var(--gold), inset 0 0 12px #fffb } }
.mt .vl { font-size: max(16px, calc(var(--u) * 3.6)); height: calc(var(--u) * 4.2); line-height: calc(var(--u) * 4.2); color: #fff1d6; }
.h-pot { left: 10px; top: 68%; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 calc(var(--u) * 2); box-sizing: border-box; border-radius: 12px; background: rgba(11,6,16,.7); box-shadow: inset 0 0 0 1px #e8b85a55; animation: pin .3s .1s both; }
.h-pot svg { width: calc(var(--u) * 5); height: calc(var(--u) * 5); min-width: 22px; min-height: 22px; }
.h-pot span { font-size: max(16px, calc(var(--u) * 4)); }
.h-pot.bump { animation: hbeat .35s; }

/* distance */
.h-dist { right: 10px; top: 26%; height: 34%; width: calc(var(--u) * 9); min-width: 44px; display: flex; flex-direction: column; align-items: center; padding: calc(var(--u) * .8) 0; box-sizing: border-box;
  background: rgba(11,6,16,.6); border-radius: 12px; box-shadow: inset 0 0 0 1px #2ff3ff44; animation: pin .3s .05s both; }
.h-dist svg { width: calc(var(--u) * 4.6); height: calc(var(--u) * 4.6); min-width: 20px; min-height: 20px; filter: drop-shadow(0 0 4px var(--cy)); }
.h-dist .trk { position: relative; flex: 1; width: 4px; margin: 4px 0; background: linear-gradient(180deg, var(--cy), #7a2fff); border-radius: 4px; box-shadow: 0 0 8px var(--cy); }
.h-dist .mk { position: absolute; left: 50%; top: 0; width: calc(var(--u) * 3.4); height: calc(var(--u) * 3.4); min-width: 14px; min-height: 14px; margin: -7px 0 0 calc(var(--u) * -1.7); border-radius: 50%; background: #fff; border: 3px solid var(--cy); box-shadow: 0 0 10px var(--cy); box-sizing: border-box; transition: top .3s linear; }
.h-dist .dn { font-size: max(14px, calc(var(--u) * 3.2)); white-space: nowrap; color: #d6fcff; }
.h-dist.danger { animation: dshake .25s infinite; box-shadow: inset 0 0 0 1px #f03, 0 0 12px #f03a; }
.h-dist.danger .trk { background: linear-gradient(180deg, #ff2a4a, #6a0018); box-shadow: 0 0 8px #f03; }
.h-dist.danger .mk { border-color: #f23; box-shadow: 0 0 10px #f23; }
.h-dist.danger .dn { color: #ff6377; }
@keyframes dshake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-2px) } 75% { transform: translateX(2px) } }

/* serve + rare */
.h-serve { right: 16px; top: 62%; width: calc(var(--u) * 24); min-width: 120px; height: calc(var(--u) * 11.5); min-height: 52px; box-sizing: border-box; cursor: pointer; font: inherit; color: var(--gold);
  border: solid transparent; border-width: calc(var(--u) * 2.4); border-image: url(../assets/ui-button.webp) 30% fill / calc(var(--u) * 2.4) stretch; background: none; padding: 0;
  display: flex; align-items: center; justify-content: center; font-size: max(18px, calc(var(--u) * 5)); transition: transform .12s, filter .2s; animation: pin .3s .1s both; filter: drop-shadow(0 0 8px #ff2fa888); }
.h-serve:active { transform: scale(.92, .88); }
.h-serve.off { filter: grayscale(1) brightness(.6); }
.h-serve:not(.off) { animation: pin .3s .1s both, sglow 1.6s 0.4s infinite; }
@keyframes sglow { 50% { filter: drop-shadow(0 0 14px #ffcf7a) brightness(1.15) } }
.h-rare { right: calc(16px + var(--u) * 24 + 10px); top: 62%; height: calc(var(--u) * 11.5); min-height: 52px; }
.rplate { position: relative; height: 100%; aspect-ratio: 1; min-width: 52px; border-radius: 12px; border: 2px solid var(--gold); background: rgba(11,6,16,.85) center/cover; box-shadow: 0 0 10px #ffcf7a66; cursor: pointer; padding: 0; color: var(--gold); font: inherit; transition: transform .12s; box-sizing: border-box; }
.rplate:active { transform: scale(.92); }
.rplate b { position: absolute; right: 2px; bottom: 0; font-size: max(14px, calc(var(--u) * 3.4)); }
.rpop { position: absolute; right: 0; bottom: calc(100% + 8px); display: none; gap: 8px; padding: 8px; background: rgba(11,6,16,.92); border-radius: 12px; box-shadow: inset 0 0 0 1px #e8b85a88, 0 0 12px #000; }
.rpop.open { display: flex; animation: pin .2s both; }
.rpop .ri { position: relative; width: 52px; height: 52px; min-width: 52px; border-radius: 10px; border: 2px solid var(--gold); background: center/cover; cursor: pointer; padding: 0; color: var(--gold); font: inherit; box-sizing: border-box; }
.rpop .ri b { position: absolute; right: 2px; bottom: 0; font-size: 14px; }

/* hand */
.h-hand { left: 47%; bottom: calc(var(--u) * 2); transform: translateX(-50%); display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.h-hand > * { pointer-events: auto; }
.slot { position: relative; width: calc(var(--u) * 18); height: calc(var(--u) * 27); margin-left: calc(var(--u) * 1); touch-action: none; }
.slot:first-child { margin-left: 0; }
.slot.empty::before { content: ""; position: absolute; inset: 4px; border: 2px dashed #ffcf7a99; border-radius: 10px; }
.slot.drag .card { opacity: .3; }
.card { position: absolute; inset: 0; transform: translateY(var(--y, 0)) rotate(var(--r, 0deg)); transform-origin: 50% 120%; transition: transform .22s cubic-bezier(.3,1.5,.5,1); cursor: grab; }
.slot.sel .card { transform: translateY(calc(var(--u) * -3.2)) rotate(0deg) scale(1.06); z-index: 5; }
.slot.sel { z-index: 5; }
.cin { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; background: #140a1a center/cover no-repeat; border: 2px solid transparent; box-sizing: border-box;
  box-shadow: 0 4px 10px #000a; }
.cin::after { content: ""; position: absolute; inset: 0; border-radius: 8px; padding: 2px; background: linear-gradient(135deg, #fff0b0, #c88a2a 40%, #ffe08a 60%, #8a5a14); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.slot.sel .cin { box-shadow: 0 0 18px 4px var(--gold), 0 4px 10px #000a; }
.cin.cursed { animation: curse 1.2s infinite, cshake .3s infinite; }
.cin.rare { animation: shim 2s infinite; }
@keyframes curse { 50% { box-shadow: 0 0 20px 5px var(--mag), 0 4px 10px #000a } 0%,100% { box-shadow: 0 0 8px 2px var(--mag), 0 4px 10px #000a } }
@keyframes cshake { 0%,100% { transform: translateX(0) } 50% { transform: translateX(1px) rotate(.4deg) } }
@keyframes shim { 50% { box-shadow: 0 0 18px 4px #ffe08a, 0 4px 10px #000a; filter: brightness(1.2) } }
.cin.deal { animation: deal .5s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes deal { from { transform: translateX(60vw) rotateY(180deg) } to { transform: none } }
.cin .back { position: absolute; inset: 0; background: center/cover; border-radius: 8px; opacity: 0; }
.cin.deal .back { animation: bk .5s both; }
@keyframes bk { 0%,50% { opacity: 1 } 51%,100% { opacity: 0 } }
.cin .nm { position: absolute; left: 0; right: 0; top: 0; padding: 3px 4px; text-align: center; background: linear-gradient(180deg, rgba(10,4,14,.92), rgba(10,4,14,.7)); font-size: clamp(12px, calc(var(--u) * 3), 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
.cin .gems { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: center; gap: 3px; flex-wrap: nowrap; }
.gem { min-width: calc(var(--u) * 5); height: calc(var(--u) * 4); padding: 0 4px; box-sizing: border-box; border-radius: 99px; background: rgba(8,3,12,.88); border: 1.5px solid var(--c); color: var(--c); font-size: max(12px, calc(var(--u) * 3)); line-height: calc(var(--u) * 4 - 2px); text-align: center; box-shadow: 0 0 5px var(--c); }
.ward { display: inline-flex; align-items: center; gap: 2px; height: calc(var(--u) * 4); padding: 0 4px; border-radius: 99px; background: rgba(8,3,12,.88); border: 1.5px solid var(--cy); color: var(--cy); font-size: max(12px, calc(var(--u) * 3)); box-shadow: 0 0 5px var(--cy); box-sizing: border-box; }
.ward i { width: .8em; height: .9em; background: var(--cy); clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }

/* drag ghost */
.ghost { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none !important; will-change: transform; }
.ghost .cin { box-shadow: 0 0 22px 5px var(--gold), 0 8px 16px #000a; }
.glabel { position: fixed; left: 0; top: 0; z-index: 41; pointer-events: none !important; padding: 4px 12px; border-radius: 99px; background: rgba(11,6,16,.9); border: 2px solid var(--gold); font-size: max(14px, calc(var(--u) * 3.6)); white-space: nowrap; transition: opacity .12s; }

/* overlays */
.ol-flash { inset: 0; opacity: 0; z-index: 30; }
.ol-flash.serve { background: radial-gradient(circle, rgba(255,230,150,.85), rgba(255,170,60,.45)); animation: fl .25s; }
.ol-flash.hurt { background: radial-gradient(circle, rgba(255,0,40,.15), rgba(255,0,40,.6)); animation: fl .3s; }
@keyframes fl { 0% { opacity: 0 } 25% { opacity: 1 } 100% { opacity: 0 } }
#vignette.beat { animation: vbeat .8s infinite; }
@keyframes vbeat { 0%,100% { transform: scale(1) } 20% { transform: scale(1.05) } 40% { transform: scale(1) } 55% { transform: scale(1.03) } }

.ol-banner { left: 0; right: 0; top: 22%; text-align: center; z-index: 35; display: none; }
.ol-banner.go { display: block; animation: bn 1.6s both; }
.ol-banner .bt { font-size: max(28px, calc(var(--u) * 11)); color: #ffe08a; text-shadow: 2px 0 var(--plum), -2px 0 var(--plum), 0 2px var(--plum), 0 -2px var(--plum), 0 5px 0 #5a1030, 0 0 24px #ff2fa8aa; }
.ol-banner .bs { margin-top: 4px; font-size: max(16px, calc(var(--u) * 4.6)); color: #fff1d6; text-shadow: 1px 0 var(--plum), -1px 0 var(--plum), 0 1px var(--plum), 0 -1px var(--plum), 0 2px 3px #000; }
@keyframes bn { 0% { opacity: 0; transform: scale(1.6) } 15% { opacity: 1; transform: scale(.95) } 25% { transform: scale(1) } 85% { opacity: 1; transform: scale(1) } 100% { opacity: 0; transform: scale(1.05) } }

.ol-bark { left: 50%; top: calc(6px + var(--u) * 10); transform: translateX(-50%); max-width: 60%; z-index: 33; display: none; align-items: center; gap: 8px; padding: 4px 16px 4px 4px; border-radius: 99px; background: rgba(11,6,16,.88); box-shadow: inset 0 0 0 2px var(--gold), 0 0 12px #000a; }
.ol-bark.show { display: flex; animation: pin .25s both; }
.ol-bark.out { opacity: 0; transition: opacity .3s; }
.ol-bark .bp { width: calc(var(--u) * 7); height: calc(var(--u) * 7); min-width: 30px; min-height: 30px; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--gold); display: none; }
.ol-bark.noi .bp { display: block; }
.ol-bark .bx { padding: 2px 8px; font-size: max(14px, calc(var(--u) * 3.6)); color: #fff1d6; }
.ol-bark.gourmand { box-shadow: inset 0 0 0 2px #ff2a4a, 0 0 14px #f03; background: rgba(40,0,10,.92); }
.ol-bark.gourmand .bx { color: #ff6b7c; animation: glitch .25s infinite; }
.ol-bark.narrator .bx { font-style: italic; }
@keyframes glitch { 0%,100% { transform: translate(0) } 33% { transform: translate(-1px,1px); text-shadow: 2px 0 #2ff3ff } 66% { transform: translate(1px,-1px); text-shadow: -2px 0 #ff2fa8 } }

.ol-float { z-index: 36; white-space: nowrap; font-size: max(18px, calc(var(--u) * 5)); opacity: 0; transform: translate(-50%,-50%); }
.ol-float.go { animation: fup .9s ease-out both; }
@keyframes fup { 0% { opacity: 0; margin-top: 0 } 15% { opacity: 1 } 100% { opacity: 0; margin-top: -40px } }

.ol-hint { left: 50%; bottom: calc(6px + var(--u) * 32); transform: translateX(-50%); z-index: 20; display: none; max-width: 70%; text-align: center; padding: 6px 18px; border-radius: 99px; background: linear-gradient(#f6e3b4, #d9bd84); color: #3a1a0a; box-shadow: 0 0 14px #ffcf7a99, inset 0 0 0 2px #8a5a14; font-size: max(14px, calc(var(--u) * 3.6)); text-shadow: none; animation: hintp 1.4s infinite; }
.ol-hint.show { display: block; }
.ol-hint::after { content: ""; position: absolute; left: 50%; bottom: -10px; margin-left: -8px; border: 8px solid transparent; border-top-color: #d9bd84; border-bottom: 0; animation: arr .7s infinite alternate; }
@keyframes hintp { 50% { box-shadow: 0 0 24px #ffcf7a, inset 0 0 0 2px #8a5a14 } }
@keyframes arr { to { transform: translateY(5px) } }

/* dialogue */
.dlg { position: absolute; inset: 0; z-index: 50; display: none; background: transparent; }
.dlg.open { display: block; }
.dpanel { position: absolute; left: 6%; right: 6%; bottom: 3%; height: 30%; box-sizing: border-box; border: solid transparent; border-width: calc(var(--u) * 2.4);
  border-image: url(../assets/ui-panel.webp) 64 fill / calc(var(--u) * 2.4) stretch; padding: calc(var(--u) * 1) calc(var(--u) * 2); animation: dpin .25s cubic-bezier(.3,1.4,.5,1) both; background-clip: padding-box; padding-top: calc(var(--u) * 2.2); }
@keyframes dpin { from { opacity: 0; transform: translateY(30px) } to { opacity: 1; transform: none } }
.dpanel.g { filter: sepia(1) hue-rotate(-30deg) saturate(3) brightness(.9); }
.dpanel.g .dtext { animation: glitch .2s infinite; color: #ffd0d6; }
.dname { position: absolute; left: calc(var(--u) * 3); top: calc(var(--u) * -8.2); line-height: 1.3; padding: 2px 16px; border-radius: 8px; background: #1a0510; box-shadow: inset 0 0 0 2px var(--gold), 0 0 10px #000; font-size: max(14px, calc(var(--u) * 3.8)); }
.dtext { position: relative; color: #fff1d6; font-size: max(14px, calc(var(--u) * 3.8)); line-height: 1.45; height: 100%; overflow: hidden; }
.dtext .h { opacity: 0; }
.dpanel.n .dtext { font-style: italic; }
.dchoices { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; justify-content: center; padding: 0 calc(var(--u) * 2) calc(var(--u) * 1); }
.dch { flex: 1; max-width: 40%; min-height: 44px; box-sizing: border-box; cursor: pointer; font: inherit; font-size: max(14px, calc(var(--u) * 3.6)); color: var(--gold); padding: 0 8px;
  border: solid transparent; border-width: calc(var(--u) * 1.8); border-image: url(../assets/ui-button.webp) 30% fill / calc(var(--u) * 1.8) stretch; background: none; transition: transform .12s, filter .15s; animation: pin .2s both; }
.dch.sel { filter: brightness(1.4) drop-shadow(0 0 8px var(--gold)); transform: scale(1.06); }
.dch:active { transform: scale(.93); }
.dnext { position: absolute; right: calc(var(--u) * 1); bottom: calc(var(--u) * .5); font-size: max(12px, calc(var(--u) * 3)); color: var(--cy); animation: hintp 1s infinite; display: none; }
.dnext.show { display: block; }
.dport { position: absolute; left: 4%; bottom: calc(33% - 2px); height: 58%; display: none; object-fit: contain; object-position: bottom; filter: drop-shadow(0 0 14px #ff2fa855); pointer-events: none; }
.dport.show { display: block; animation: prise .35s cubic-bezier(.3,1.3,.5,1) both; }
@keyframes prise { from { opacity: 0; transform: translateY(40px) } to { opacity: 1; transform: none } }
