.touch-guide {display:none}
#hud {
  --spell-size:66px;
  --spell-bottom:max(30px,calc(env(safe-area-inset-bottom) + 25px));
  --spell-top:calc(var(--spell-bottom) + var(--spell-size));
}
#hud.touch-controls {--spell-bottom:max(76px,calc(env(safe-area-inset-bottom) + 67px))}
.touch-controls :is(.actions,.keys,#inspect kbd) {display:none}
.touch-controls .touch-guide {
  position:absolute;
  display:grid;
  gap:3px;
  justify-items:center;
  width:100%;
  padding-inline:12px;
  bottom:max(17px,calc(env(safe-area-inset-bottom) + 8px));
  color:#e4cfac;
  font-size:10px;
  text-align:center;
  letter-spacing:.055em;
}
#spell {
  --spell-ink:var(--fusion-ink,var(--skill-color,#ffd88d));
  position:absolute;
  z-index:1;
  left:50%;
  bottom:var(--spell-bottom);
  translate:-50% 0;
  width:var(--spell-size);
  height:var(--spell-size);
  grid-template:1fr / 1fr;
  touch-action:none;
  border-color:#b48f7375;
  background:radial-gradient(circle at 50% 45%,#44364b,#16111e 76%);
}
#spell[aria-disabled=false] {
  border-color:var(--spell-ink);
  background:radial-gradient(circle at 50% 43%,color-mix(in srgb,var(--spell-ink) 35%,#291f35),#1b1326 74%);
  box-shadow:inset 0 0 0 3px #1e1628,inset 0 0 11px color-mix(in srgb,var(--spell-ink) 38%,transparent),
    0 0 0 3px #130f1de0,0 0 18px color-mix(in srgb,var(--spell-ink) 68%,transparent),0 5px 13px #0b0717b5;
}
#spell>span {
  grid-area:1/1;
  width:78%;
  height:78%;
  color:transparent;
  text-shadow:none;
  background:var(--skill-icon) center/contain no-repeat;
}
#spell[aria-disabled=false]>span {
  filter:drop-shadow(0 0 4px var(--spell-ink));
  animation:spell-ready .38s ease-out;
}
@keyframes spell-ready {
  from {filter:brightness(1.6) drop-shadow(0 0 8px var(--spell-ink))}
}
@media (prefers-reduced-motion:reduce) {
  #spell[aria-disabled=false]>span {animation:none}
}
#spell[aria-disabled=true]>span {opacity:.36;filter:saturate(.56)}
#spell[aria-disabled=true]:active {transform:none;filter:none}
#spell-cooldown {
  grid-area:1/1;
  z-index:1;
  color:#fff1d7;
  font-size:23px;
  line-height:1;
  font-variant-numeric:tabular-nums;
  text-shadow:0 1px 4px #100a15,0 0 6px #100a15;
}
.spell-caption {
  position:absolute;
  left:50%;
  top:calc(100% + 5px);
  translate:-50% 0;
  display:flex;
  align-items:center;
  gap:5px;
  padding:2px 6px;
  background:#181320f2;
  border:1px solid #ae8a6649;
  border-radius:4px;
  pointer-events:none;
}
#spell .spell-caption em {margin:0;color:#ffe8c7;font-size:11px}
#spell .spell-caption kbd {position:static;transform:none}
.touch-controls #spell kbd {display:none}
#spell[data-aiming] #skill-link,#spell[data-aiming] .spell-caption>* {display:none}
#spell[data-aiming] .spell-caption::after {content:'放手施放';white-space:nowrap;color:#defbf0;font-size:11px}
.touch-controls #objective {bottom:max(87px,calc(env(safe-area-inset-bottom) + 76px))}
.touch-controls #inspect {
  bottom:max(126px,calc(env(safe-area-inset-bottom) + 115px));
  min-height:44px;
}
.touch-controls .utility button {min-width:40px;min-height:42px}
#world {touch-action:none}
#stick,#touch-cast {position:absolute;pointer-events:none}
#stick {
  z-index:2;
  width:74px;
  height:74px;
  transform:translate(-50%,-50%);
  border:1px solid #e4ba81a1;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#18121a72;
  box-shadow:inset 0 0 0 4px #e0bb8125,0 0 17px #0d0a13a1;
}
#stick i {
  width:26px;
  height:26px;
  border:1px solid #ffdbad;
  border-radius:50%;
  transform:translate(var(--joy-x,0px),var(--joy-y,0px));
  background:radial-gradient(circle at 35% 25%,#f7d6aabf,#825362d4);
}
#stick[data-mode=press] {opacity:.64}
#stick[data-mode=skill] {border-color:#e5addd;box-shadow:inset 0 0 0 4px #e9b1e037,0 0 18px #bd65a35e}
#touch-cast {
  z-index:3;
  width:68px;height:68px;
  transform:translate(-50%,-50%);
  border:1px solid color-mix(in srgb,var(--skill-color),#140c1b 45%);
  border-radius:50%;
  color:#fff0dd;
  background:radial-gradient(circle at 50% 45%,#453444,#17121df2 70%);
  box-shadow:0 4px 14px #0c0815cf,inset 0 0 16px #1c101a;
}
#touch-cast i {
  position:absolute;inset:2px;
  border-radius:50%;
  background:var(--skill-icon) center/contain no-repeat;
  filter:drop-shadow(0 0 5px var(--skill-color));
}
#touch-cast b {
  position:absolute;top:-15px;left:50%;transform:translateX(-50%);
  font-size:10px;letter-spacing:.065em;white-space:nowrap;color:var(--skill-color);
  padding:1px 5px;background:#100b15eb;border-radius:5px;
}
#touch-cast[data-selected=true] {
  border-color:var(--skill-color);
  background:radial-gradient(circle at 50% 45%,color-mix(in srgb,var(--skill-color),#201623 68%),#23182c 74%);
  box-shadow:0 0 16px var(--skill-color),inset 0 0 12px #e3bc985c;
}
#touch-cast[data-cooldown=true] i {opacity:.48;filter:saturate(.45)}
@media (max-width:650px) and (orientation:portrait) {
  .touch-controls .route-hud {top:max(69px,calc(env(safe-area-inset-top) + 54px))}
  .touch-controls #boss-hud,.touch-controls #mission-status {top:max(140px,calc(env(safe-area-inset-top) + 126px))}
}
@media (max-height:470px) and (orientation:landscape) {
  #hud,#hud.touch-controls {
    --spell-size:56px;
    --spell-bottom:max(28px,calc(env(safe-area-inset-bottom) + 24px));
  }
  .touch-controls .touch-guide {bottom:max(8px,env(safe-area-inset-bottom));justify-items:end;padding-right:max(12px,env(safe-area-inset-right))}
  .touch-controls #objective {bottom:max(14px,env(safe-area-inset-bottom));max-width:55%}
  .touch-controls #inspect {bottom:max(46px,calc(env(safe-area-inset-bottom) + 32px))}
}
#hud:has(#spell:not([hidden])) #objective {bottom:calc(var(--spell-top) + 31px)}
#hud:has(#spell:not([hidden])) #inspect {bottom:calc(var(--spell-top) + 70px)}
#hud:has(#spell:not([hidden])) #school-toast {bottom:calc(var(--spell-top) + 117px)}

@media (max-height:470px) and (orientation:landscape) {
  #hud.touch-controls:has(#boss-hud:not([hidden])) #objective {
    left:max(12px,env(safe-area-inset-left));
    bottom:max(10px,env(safe-area-inset-bottom));
    max-width:min(34%,260px);
    padding-inline:7px;
    transform:none;
    text-align:left;
  }
}
